Skip to content

Commit

Permalink
plugin: esc: fixed Auto mode
Browse files Browse the repository at this point in the history
  • Loading branch information
IrineSistiana committed Dec 6, 2020
1 parent 5b37ecb commit 9061ba8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dispatcher/plugin/functional/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,12 @@ func (e ecsPlugin) Do(_ context.Context, qCtx *handler.Context) (err error) {

if checkMsgHasECS(qCtx.Q) == false || e.args.ForceOverwrite {
if e.args.Auto {
s := qCtx.From.String()
ip := net.ParseIP(s)
addr := qCtx.From.String()
ipStr, _, _ := net.SplitHostPort(addr)
if len(ipStr) == 0 {
return
}
ip := net.ParseIP(ipStr)
if ip == nil {
qCtx.Logf(logrus.WarnLevel, "client address [%s] can not be parsed as ip", addr)
return nil
Expand Down

0 comments on commit 9061ba8

Please # to comment.