diff --git a/sgfw/ipc.go b/sgfw/ipc.go index cabe8f8..35d81a5 100644 --- a/sgfw/ipc.go +++ b/sgfw/ipc.go @@ -337,12 +337,7 @@ const OzSocketName = "@oz-control" var bSockName = OzSocketName -var messageFactory = ipc.NewMsgFactory( - new(ListProxiesMsg), - new(ListProxiesResp), -) - -func clientConnect() (*ipc.MsgConn, error) { +func init() { bSockName = os.Getenv("SOCKET_NAME") if bSockName != "" { @@ -356,7 +351,14 @@ func clientConnect() (*ipc.MsgConn, error) { } else { bSockName = OzSocketName } +} +var messageFactory = ipc.NewMsgFactory( + new(ListProxiesMsg), + new(ListProxiesResp), +) + +func clientConnect() (*ipc.MsgConn, error) { return ipc.Connect(bSockName, messageFactory, nil) } diff --git a/sgfw/rules.go b/sgfw/rules.go index 08a89cb..a3e1623 100644 --- a/sgfw/rules.go +++ b/sgfw/rules.go @@ -248,7 +248,7 @@ func (r *Rule) parse(s string) bool { r.saddr = nil parts := strings.Split(s, "|") if len(parts) < 4 || len(parts) > 6 { - log.Notice("invalid number ", len(parts), " of rule parts in line ", s) + log.Notice("Error: invalid number ", len(parts), " of rule parts in line ", s) return false } if parts[2] == "SYSTEM" { @@ -276,7 +276,7 @@ func (r *Rule) parse(s string) bool { r.saddr = net.ParseIP(parts[5]) if r.saddr == nil { - log.Notice("invalid source IP ", parts[5], " in line ", s) + log.Notice("Error: invalid source IP ", parts[5], " in line ", s) return false }