diff --git a/cmd/gost/cmd.go b/cmd/gost/cmd.go index 136a917..2cb60bf 100644 --- a/cmd/gost/cmd.go +++ b/cmd/gost/cmd.go @@ -4,7 +4,6 @@ import ( "encoding/base64" "errors" "fmt" - "net" "net/url" "strings" "time" @@ -155,6 +154,10 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) { cfg.Services = append(cfg.Services, service) md := metadata.MapMetadata(service.Handler.Metadata) + if v := metadata.GetInt(md, "retries"); v > 0 { + service.Handler.Retries = v + md.Del("retries") + } if v := metadata.GetString(md, "bypass"); v != "" { bypassCfg := &config.BypassConfig{ Name: fmt.Sprintf("bypass-%d", len(cfg.Bypasses)), @@ -480,24 +483,3 @@ func parseSelector(md metadata.MapMetadata) *config.SelectorConfig { FailTimeout: failTimeout, } } - -func parseIP(s, port string) (ips []string) { - if s == "" { - return nil - } - if port == "" { - port = "8080" - } - - for _, v := range strings.Split(s, ",") { - if v == "" { - continue - } - if _, _, err := net.SplitHostPort(v); err != nil { - v = net.JoinHostPort(v, port) // assume the port is missing - } - ips = append(ips, v) - } - - return -} diff --git a/pkg/chain/node.go b/pkg/chain/node.go index 9972396..eaa397e 100644 --- a/pkg/chain/node.go +++ b/pkg/chain/node.go @@ -68,7 +68,7 @@ func (m *FailMarker) FailTime() int64 { return 0 } - return atomic.LoadInt64(&m.failCount) + return atomic.LoadInt64(&m.failTime) } func (m *FailMarker) FailCount() int64 {