mirror of https://github.com/go-gost/gost.git
Compare commits
No commits in common. "9d00ad8c8f66117ec60736488025f8441126c975" and "06ec0097f9668241742d0e981dcd4034e10e112d" have entirely different histories.
9d00ad8c8f
...
06ec0097f9
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-gost/core/logger"
|
"github.com/go-gost/core/logger"
|
||||||
xlogger "github.com/go-gost/x/logger"
|
xlogger "github.com/go-gost/x/logger"
|
||||||
|
|
@ -29,7 +28,7 @@ func (l *stringList) Set(value string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
cfgFiles stringList
|
cfgFile string
|
||||||
outputFormat string
|
outputFormat string
|
||||||
services stringList
|
services stringList
|
||||||
nodes stringList
|
nodes stringList
|
||||||
|
|
@ -37,7 +36,6 @@ var (
|
||||||
trace bool
|
trace bool
|
||||||
apiAddr string
|
apiAddr string
|
||||||
metricsAddr string
|
metricsAddr string
|
||||||
reload time.Duration
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -89,14 +87,13 @@ func init() {
|
||||||
|
|
||||||
flag.Var(&services, "L", "service list")
|
flag.Var(&services, "L", "service list")
|
||||||
flag.Var(&nodes, "F", "chain node list")
|
flag.Var(&nodes, "F", "chain node list")
|
||||||
flag.Var(&cfgFiles, "C", "config file(s), URL(s), or inline JSON")
|
flag.StringVar(&cfgFile, "C", "", "configuration file")
|
||||||
flag.BoolVar(&printVersion, "V", false, "print version")
|
flag.BoolVar(&printVersion, "V", false, "print version")
|
||||||
flag.StringVar(&outputFormat, "O", "", "output format, one of yaml|json format")
|
flag.StringVar(&outputFormat, "O", "", "output format, one of yaml|json format")
|
||||||
flag.BoolVar(&debug, "D", false, "debug mode")
|
flag.BoolVar(&debug, "D", false, "debug mode")
|
||||||
flag.BoolVar(&trace, "DD", false, "trace mode")
|
flag.BoolVar(&trace, "DD", false, "trace mode")
|
||||||
flag.StringVar(&apiAddr, "api", "", "api service address")
|
flag.StringVar(&apiAddr, "api", "", "api service address")
|
||||||
flag.StringVar(&metricsAddr, "metrics", "", "metrics service address")
|
flag.StringVar(&metricsAddr, "metrics", "", "metrics service address")
|
||||||
flag.DurationVar(&reload, "R", 0, "auto reload period (e.g. 30s, 1m)")
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if printVersion {
|
if printVersion {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/go-gost/core/auth"
|
"github.com/go-gost/core/auth"
|
||||||
"github.com/go-gost/core/logger"
|
"github.com/go-gost/core/logger"
|
||||||
|
|
@ -35,7 +34,7 @@ type program struct {
|
||||||
|
|
||||||
func (p *program) Init(env svc.Environment) error {
|
func (p *program) Init(env svc.Environment) error {
|
||||||
parser.Init(parser.Args{
|
parser.Init(parser.Args{
|
||||||
CfgFiles: cfgFiles,
|
CfgFile: cfgFile,
|
||||||
Services: services,
|
Services: services,
|
||||||
Nodes: nodes,
|
Nodes: nodes,
|
||||||
Debug: debug,
|
Debug: debug,
|
||||||
|
|
@ -194,13 +193,6 @@ func (p *program) reload(ctx context.Context) {
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, syscall.SIGHUP)
|
signal.Notify(c, syscall.SIGHUP)
|
||||||
|
|
||||||
var ticker <-chan time.Time
|
|
||||||
if reload > 0 {
|
|
||||||
t := time.NewTicker(reload)
|
|
||||||
defer t.Stop()
|
|
||||||
ticker = t.C
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-c:
|
case <-c:
|
||||||
|
|
@ -210,13 +202,6 @@ func (p *program) reload(ctx context.Context) {
|
||||||
logger.Default().Info("config reloaded")
|
logger.Default().Info("config reloaded")
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-ticker:
|
|
||||||
if err := p.reloadConfig(); err != nil {
|
|
||||||
logger.Default().Errorf("auto reload: %v", err)
|
|
||||||
} else {
|
|
||||||
logger.Default().Debug("config auto reloaded")
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ import (
|
||||||
_ "github.com/go-gost/x/dialer/tls"
|
_ "github.com/go-gost/x/dialer/tls"
|
||||||
_ "github.com/go-gost/x/dialer/udp"
|
_ "github.com/go-gost/x/dialer/udp"
|
||||||
_ "github.com/go-gost/x/dialer/unix"
|
_ "github.com/go-gost/x/dialer/unix"
|
||||||
_ "github.com/go-gost/x/dialer/utls"
|
|
||||||
_ "github.com/go-gost/x/dialer/ws"
|
_ "github.com/go-gost/x/dialer/ws"
|
||||||
|
|
||||||
// Register handlers
|
// Register handlers
|
||||||
|
|
|
||||||
4
go.mod
4
go.mod
|
|
@ -4,7 +4,7 @@ go 1.26.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-gost/core v0.4.1
|
github.com/go-gost/core v0.4.1
|
||||||
github.com/go-gost/x v0.12.0
|
github.com/go-gost/x v0.11.1
|
||||||
github.com/judwhite/go-svc v1.2.1
|
github.com/judwhite/go-svc v1.2.1
|
||||||
github.com/moby/moby/client v0.4.0
|
github.com/moby/moby/client v0.4.0
|
||||||
github.com/stretchr/testify v1.11.1
|
github.com/stretchr/testify v1.11.1
|
||||||
|
|
@ -17,7 +17,6 @@ require (
|
||||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||||
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
|
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
|
||||||
github.com/alessio/shellescape v1.4.1 // indirect
|
github.com/alessio/shellescape v1.4.1 // indirect
|
||||||
github.com/andybalholm/brotli v1.0.6 // indirect
|
|
||||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/bytedance/sonic v1.11.6 // indirect
|
github.com/bytedance/sonic v1.11.6 // indirect
|
||||||
|
|
@ -110,7 +109,6 @@ require (
|
||||||
github.com/quic-go/qpack v0.6.0 // indirect
|
github.com/quic-go/qpack v0.6.0 // indirect
|
||||||
github.com/quic-go/quic-go v0.59.1 // indirect
|
github.com/quic-go/quic-go v0.59.1 // indirect
|
||||||
github.com/quic-go/webtransport-go v0.10.0 // indirect
|
github.com/quic-go/webtransport-go v0.10.0 // indirect
|
||||||
github.com/refraction-networking/utls v1.8.2 // indirect
|
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
||||||
github.com/rs/xid v1.3.0 // indirect
|
github.com/rs/xid v1.3.0 // indirect
|
||||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||||
|
|
|
||||||
10
go.sum
10
go.sum
|
|
@ -12,8 +12,6 @@ github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAu
|
||||||
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
|
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
|
||||||
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
|
github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0=
|
||||||
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
|
github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30=
|
||||||
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
|
|
||||||
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
|
|
||||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
|
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
|
||||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
|
|
@ -97,8 +95,10 @@ github.com/go-gost/relay v0.6.0 h1:o8r0B3eTw8Rwwent+5x5Cw1g4AyNUl4hNqiyDJXkFvA=
|
||||||
github.com/go-gost/relay v0.6.0/go.mod h1:Dku0f5sfjOClrZFiDmQUrYYJ4uof7rnkCUBfsl0PSAI=
|
github.com/go-gost/relay v0.6.0/go.mod h1:Dku0f5sfjOClrZFiDmQUrYYJ4uof7rnkCUBfsl0PSAI=
|
||||||
github.com/go-gost/tls-dissector v0.2.0 h1:9tE6WOzzpurATTBWn60DU4R8gibpGNY8/qVcc1SicVg=
|
github.com/go-gost/tls-dissector v0.2.0 h1:9tE6WOzzpurATTBWn60DU4R8gibpGNY8/qVcc1SicVg=
|
||||||
github.com/go-gost/tls-dissector v0.2.0/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
|
github.com/go-gost/tls-dissector v0.2.0/go.mod h1:/9QfdewqmHdaE362Hv5nDaSWLx3pCmtD870d6GaquXs=
|
||||||
github.com/go-gost/x v0.12.0 h1:gHiLZ4b6wLEsACzAsS6TDWgJnSFeIv822EBdMrpWtag=
|
github.com/go-gost/x v0.11.0 h1:fTkdKSwIfTwGtBmYA4sguWJUv4KnvqWyUNv4mr0lAlE=
|
||||||
github.com/go-gost/x v0.12.0/go.mod h1:mUbt9jmZDDxq1ERbtcMVFndzFHgICjMDWiaManx/tRU=
|
github.com/go-gost/x v0.11.0/go.mod h1:gKZwVEQh4ebC9eLP8zv9z3TwfOuKEl1Kk0vC/BfQaUQ=
|
||||||
|
github.com/go-gost/x v0.11.1 h1:GdJYOeKi+IXzcnKTJ62CqwsMOmleLSfJV8qHf48dZiI=
|
||||||
|
github.com/go-gost/x v0.11.1/go.mod h1:gKZwVEQh4ebC9eLP8zv9z3TwfOuKEl1Kk0vC/BfQaUQ=
|
||||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
|
|
@ -258,8 +258,6 @@ github.com/quic-go/quic-go v0.59.1 h1:0Gmua0HW1Tv7ANR7hUYwRyD0MG5OJfgvYSZasGZzBi
|
||||||
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
github.com/quic-go/quic-go v0.59.1/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||||
github.com/quic-go/webtransport-go v0.10.0 h1:LqXXPOXuETY5Xe8ITdGisBzTYmUOy5eSj+9n4hLTjHI=
|
github.com/quic-go/webtransport-go v0.10.0 h1:LqXXPOXuETY5Xe8ITdGisBzTYmUOy5eSj+9n4hLTjHI=
|
||||||
github.com/quic-go/webtransport-go v0.10.0/go.mod h1:LeGIXr5BQKE3UsynwVBeQrU1TPrbh73MGoC6jd+V7ow=
|
github.com/quic-go/webtransport-go v0.10.0/go.mod h1:LeGIXr5BQKE3UsynwVBeQrU1TPrbh73MGoC6jd+V7ow=
|
||||||
github.com/refraction-networking/utls v1.8.2 h1:j4Q1gJj0xngdeH+Ox/qND11aEfhpgoEvV+S9iJ2IdQo=
|
|
||||||
github.com/refraction-networking/utls v1.8.2/go.mod h1:jkSOEkLqn+S/jtpEHPOsVv/4V4EVnelwbMQl4vCWXAM=
|
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue