Allow comments in the fowarding rules

This commit is contained in:
Frank Denis 2018-01-17 12:27:29 +01:00
parent ee90d243c0
commit adcdb94d99
1 changed files with 5 additions and 1 deletions

View File

@ -35,8 +35,12 @@ func (plugin *PluginForward) Init(proxy *Proxy) error {
return err return err
} }
for lineNo, line := range strings.Split(string(bin), "\n") { for lineNo, line := range strings.Split(string(bin), "\n") {
line = strings.Trim(line, " \t\r")
if len(line) == 0 || strings.HasPrefix(line, "#") {
continue
}
parts := strings.SplitN(line, ":", 2) parts := strings.SplitN(line, ":", 2)
if len(parts) == 0 || len(strings.Trim(parts[0], " \t\r")) == 0 { if len(parts) == 0 {
continue continue
} }
if len(parts) != 2 { if len(parts) != 2 {