mirror of
https://github.com/Li4n0/revsuit.git
synced 2026-09-21 22:30:46 +08:00
feat(ftp): support upload, download and PASV rebind (#13)
Co-authored-by: E99p1ant <[email protected]>
This commit is contained in:
@@ -1,12 +1,20 @@
|
||||
package rule
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func CompileTpl(tpl string, vars map[string]string) (compiled string) {
|
||||
compiled = tpl
|
||||
// CompileTpl receive []byte or string type tpl and variables map.
|
||||
// Return the template after variable substitution
|
||||
func CompileTpl(tpl interface{}, vars map[string]string) (compiled string) {
|
||||
switch v := tpl.(type) {
|
||||
case string:
|
||||
compiled = v
|
||||
case []byte:
|
||||
compiled = string(v)
|
||||
}
|
||||
for n, v := range vars {
|
||||
compiled = strings.ReplaceAll(compiled, "${"+n+"}", v)
|
||||
}
|
||||
|
||||
return compiled
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user