diff --git a/cmd/gost/cmd.go b/cmd/gost/cmd.go index dab7845..255d5ce 100644 --- a/cmd/gost/cmd.go +++ b/cmd/gost/cmd.go @@ -9,9 +9,8 @@ import ( "strings" "time" - "github.com/go-gost/gost/v3/pkg/config" + "github.com/go-gost/config" "github.com/go-gost/gost/v3/pkg/metadata" - metrics "github.com/go-gost/gost/v3/pkg/metrics/service" "github.com/go-gost/gost/v3/pkg/registry" ) @@ -35,15 +34,14 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) { if v := os.Getenv("GOST_PROFILING"); v != "" { cfg.Profiling = &config.ProfilingConfig{ - Addr: v, Enable: true, + Addr: v, } } if v := os.Getenv("GOST_METRICS"); v != "" { cfg.Metrics = &config.MetricsConfig{ Enable: true, Addr: v, - Path: metrics.DefaultPath, } } @@ -53,6 +51,12 @@ func buildConfigFromCmd(services, nodes stringList) (*config.Config, error) { } } + if v := os.Getenv("GOST_API"); v != "" { + cfg.API = &config.APIConfig{ + Addr: v, + } + } + var chain *config.ChainConfig if len(nodes) > 0 { chain = &config.ChainConfig{ diff --git a/cmd/gost/config.go b/cmd/gost/config.go index e7b809f..2f9f5b8 100644 --- a/cmd/gost/config.go +++ b/cmd/gost/config.go @@ -4,9 +4,9 @@ import ( "io" "os" - "github.com/go-gost/gost/v3/pkg/api" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" + "github.com/go-gost/api" + "github.com/go-gost/config" + "github.com/go-gost/config/parsing" "github.com/go-gost/gost/v3/pkg/logger" metrics "github.com/go-gost/gost/v3/pkg/metrics/service" "github.com/go-gost/gost/v3/pkg/registry" diff --git a/cmd/gost/main.go b/cmd/gost/main.go index 5e43bb9..7732b67 100644 --- a/cmd/gost/main.go +++ b/cmd/gost/main.go @@ -8,7 +8,7 @@ import ( "os" "runtime" - "github.com/go-gost/gost/v3/pkg/config" + "github.com/go-gost/config" "github.com/go-gost/gost/v3/pkg/logger" "github.com/go-gost/gost/v3/pkg/metrics" ) diff --git a/cmd/gost/tls.go b/cmd/gost/tls.go index 69e54ad..be35d57 100644 --- a/cmd/gost/tls.go +++ b/cmd/gost/tls.go @@ -10,8 +10,8 @@ import ( "math/big" "time" + "github.com/go-gost/config" tls_util "github.com/go-gost/gost/v3/pkg/common/util/tls" - "github.com/go-gost/gost/v3/pkg/config" ) func buildDefaultTLSConfig(cfg *config.TLSConfig) { diff --git a/go.mod b/go.mod index 2ddc776..a6377f3 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,12 @@ module github.com/go-gost/gost/v3 go 1.18 +replace github.com/templexxx/cpu v0.0.7 => github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a + require ( github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d - github.com/gin-contrib/cors v1.3.1 - github.com/gin-gonic/gin v1.7.7 + github.com/go-gost/api v0.0.0-20220314132010-fb9f62042a6a + github.com/go-gost/config v0.0.0-20220314131548-69ef8eeb9733 github.com/go-gost/gosocks4 v0.0.1 github.com/go-gost/gosocks5 v0.3.1-0.20211109033403-d894d75b7f09 github.com/go-gost/x v0.0.0-20220314122750-ba23628a0e42 @@ -13,10 +15,8 @@ require ( github.com/miekg/dns v1.1.26 github.com/prometheus/client_golang v1.12.1 github.com/sirupsen/logrus v1.8.1 - github.com/spf13/viper v1.9.0 github.com/xtaci/smux v1.5.16 golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 - gopkg.in/yaml.v2 v2.4.0 ) require ( @@ -28,7 +28,9 @@ require ( github.com/coreos/go-iptables v0.5.0 // indirect github.com/docker/libcontainer v2.2.1+incompatible // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/gin-contrib/cors v1.3.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect + github.com/gin-gonic/gin v1.7.7 // indirect github.com/go-gost/relay v0.1.1-0.20211123134818-8ef7fd81ffd7 // indirect github.com/go-gost/tls-dissector v0.0.2-0.20211125135007-2b5d5bd9c07e // indirect github.com/go-playground/locales v0.13.0 // indirect @@ -45,15 +47,15 @@ require ( github.com/klauspost/reedsolomon v1.9.9 // indirect github.com/leodido/go-urn v1.2.0 // indirect github.com/lucas-clemente/quic-go v0.25.0 // indirect - github.com/magiconair/properties v1.8.5 // indirect + github.com/magiconair/properties v1.8.6 // indirect github.com/marten-seemann/qpack v0.2.1 // indirect github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 // indirect - github.com/mattn/go-isatty v0.0.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/milosgajdos/tenus v0.0.3 // indirect - github.com/mitchellh/mapstructure v1.4.2 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -69,10 +71,11 @@ require ( github.com/shadowsocks/go-shadowsocks2 v0.1.5 // indirect github.com/shadowsocks/shadowsocks-go v0.0.0-20200409064450-3e585ff90601 // indirect github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 // indirect - github.com/spf13/afero v1.6.0 // indirect + github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/spf13/viper v1.10.0 // indirect github.com/subosito/gotenv v1.2.0 // indirect github.com/templexxx/cpu v0.0.7 // indirect github.com/templexxx/xorsimd v0.4.1 // indirect @@ -86,9 +89,10 @@ require ( golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.5 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 // indirect + google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect google.golang.org/grpc v1.45.0 // indirect google.golang.org/protobuf v1.27.1 // indirect - gopkg.in/ini.v1 v1.63.2 // indirect + gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 3f159eb..448ffaf 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,7 @@ cloud.google.com/go v0.37.0/go.mod h1:TS1dMSSfndXH133OKGwekG838Om/cQT0BUHV3HcBgo cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= @@ -17,14 +18,7 @@ cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOY cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= +cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -33,7 +27,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/firestore v1.6.0/go.mod h1:afJwI0vaXwAG54kI7A//lP/lSPDkQORQuMkv56TxEPU= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -43,6 +36,7 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= @@ -63,17 +57,12 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= 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/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -97,9 +86,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-iptables v0.5.0 h1:mw6SAibtHKZcNzAsOxjoHIG0gy5YFHhypWSSNc6EjbQ= github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= -github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -111,12 +98,9 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -136,6 +120,10 @@ github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gost/api v0.0.0-20220314132010-fb9f62042a6a h1:omtLcSi8zs+Bi5eFZt16S364qnzADN0XaRlXysbjuek= +github.com/go-gost/api v0.0.0-20220314132010-fb9f62042a6a/go.mod h1:KSqpPSLY4nzNKU1iitZsGghXECh+afmexaCOUWewgT4= +github.com/go-gost/config v0.0.0-20220314131548-69ef8eeb9733 h1:TrBS1GYkM0WZBEMBlzHzB5lwp/VEosB4JwyhAApVnYY= +github.com/go-gost/config v0.0.0-20220314131548-69ef8eeb9733/go.mod h1:bz3HBlZwBiyiRmHcEgrxls6c824tubyw7FcSVgs75z8= github.com/go-gost/gosocks4 v0.0.1 h1:+k1sec8HlELuQV7rWftIkmy8UijzUt2I6t+iMPlGB2s= github.com/go-gost/gosocks4 v0.0.1/go.mod h1:3B6L47HbU/qugDg4JnoFPHgJXE43Inz8Bah1QaN9qCc= github.com/go-gost/gosocks5 v0.3.1-0.20211109033403-d894d75b7f09 h1:A95M6UWcfZgOuJkQ7QLfG0Hs5peWIUSysCDNz4pfe04= @@ -167,9 +155,7 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8Wd github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -182,7 +168,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -200,10 +185,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -216,11 +199,9 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -229,7 +210,6 @@ github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= @@ -239,46 +219,24 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= -github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= -github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= -github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= -github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= -github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= -github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= -github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE= -github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -295,7 +253,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/cpuid v1.2.4/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s= @@ -306,9 +263,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxv github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= -github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= @@ -319,8 +275,8 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx github.com/lucas-clemente/quic-go v0.25.0 h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc= github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls= -github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= +github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/marten-seemann/qpack v0.2.1 h1:jvTsT/HpCn2UZJdP+UUB53FfUUgeOyG5K1ns0OJOGVs= github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= @@ -331,31 +287,19 @@ github.com/marten-seemann/qtls-go1-17 v0.1.0 h1:P9ggrs5xtwiqXv/FHNwntmuLMNq3KaSI github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8= github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1 h1:EnzzN9fPUkUck/1CuY1FlzBaIYMoiBsdwTNmNGkwUUM= github.com/marten-seemann/qtls-go1-18 v0.1.0-beta.1/go.mod h1:PUhIQk19LoFt2174H4+an8TYvWOGjb/hHwphBeaDHwI= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= -github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/milosgajdos/tenus v0.0.3 h1:jmaJzwaY1DUyYVD0lM4U+uvP2kkEg1VahDqRFxIkVBE= github.com/milosgajdos/tenus v0.0.3/go.mod h1:eIjx29vNeDOYWJuCnaHY2r4fq5egetV26ry3on7p8qY= -github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= -github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.2 h1:6h7AQ0yhTcIsmFmnAwQls75jp2Gzs4iB8W7pjMO+rqo= -github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104 h1:ULR/QWMgcgRiZLUjSSJMU+fW+RDMstRdmnDWj9Q+AsA= github.com/mmcloughlin/avo v0.0.0-20200803215136-443f81d77104/go.mod h1:wqKykBG2QzQDJEzvRkcS8x6MiSJkF52hXZsXcjaB3ls= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -383,18 +327,15 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je41yGY= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhECwM= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= +github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= -github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -427,9 +368,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= -github.com/sagikazarmark/crypt v0.1.0/go.mod h1:B/mN0msZuINBtQ1zZLEQcegFJJf9vnYIR88KRMEuODE= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shadowsocks/go-shadowsocks2 v0.1.5 h1:PDSQv9y2S85Fl7VBeOMF9StzeXZyK1HakRm86CUbr28= github.com/shadowsocks/go-shadowsocks2 v0.1.5/go.mod h1:AGGpIoek4HRno4xzyFiAtLHkOpcoznZEkAccaI/rplM= @@ -467,16 +405,16 @@ github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8/go.mod h1:P5HUIBuIWK github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= +github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.9.0 h1:yR6EXjTp0y0cLN8OZg1CRZmOBdI88UcGkhgyJhu6nZk= -github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= +github.com/spf13/viper v1.10.0 h1:mXH0UwHS4D2HwWZa75im4xIQynLfblmWV7qcWpfv0yk= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -490,8 +428,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/templexxx/cpu v0.0.1/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk= -github.com/templexxx/cpu v0.0.7 h1:pUEZn8JBy/w5yzdYWgx+0m0xL9uk6j4K91C5kOViAzo= -github.com/templexxx/cpu v0.0.7/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk= +github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a h1:f0GQM8LuKYnXdNLcAg+di6PULSlR5iQtZT3bDwDRiA0= +github.com/templexxx/cpu v0.0.10-0.20211111114238-98168dcec14a/go.mod h1:w7Tb+7qgcAlIyX4NhLuDKt78AHA5SzPmq0Wj6HiEnnk= github.com/templexxx/xorsimd v0.4.1 h1:iUZcywbOYDRAZUasAs2eSCUW8eobuZDy0I9FJiORkVg= github.com/templexxx/xorsimd v0.4.1/go.mod h1:W+ffZz8jJMH2SXwuKu9WhygqBMbFnp14G2fqEr8qaNo= github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM= @@ -514,9 +452,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs= -go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= -go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -524,22 +459,16 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= -go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/arch v0.0.0-20190909030613-46d78d1859ac/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -547,7 +476,8 @@ golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 h1:syTAU9FwmvzEoIYMqcPHOcVm4H3U5u90WsvuYgwpETU= golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -574,7 +504,6 @@ golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRu golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -590,7 +519,6 @@ golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -624,14 +552,11 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -646,12 +571,7 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -665,15 +585,12 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -689,7 +606,6 @@ golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -698,7 +614,6 @@ golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -722,22 +637,14 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5 h1:y/woIyUBFbpQGKS0u1aHF/40WUDnek3fPOyD08H5Vng= golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -799,7 +706,6 @@ golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200808161706-5bf02b21f123/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -810,12 +716,9 @@ golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -845,14 +748,6 @@ google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz513 google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -901,24 +796,10 @@ google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 h1:z+ErRPu0+KS02Td3fOAgdX+lnPDh/VyaABEJPD4JRQs= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa h1:I0YcKz0I7OAhddo7ya8kMnvprhcWM045PmkBdMO9zN0= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= @@ -940,16 +821,9 @@ google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc v1.45.0 h1:NEpgUqV3Z+ZjkqMsxMg11IaDrXY4RY6CQukSGK0uI1M= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -974,8 +848,8 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/ini.v1 v1.63.2 h1:tGK/CyBg7SMzb60vP1M03vNZ3VDu3wGQJwn7Sxi9r3c= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= +gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -989,7 +863,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/api/api.go b/pkg/api/api.go deleted file mode 100644 index 5b7fcce..0000000 --- a/pkg/api/api.go +++ /dev/null @@ -1,15 +0,0 @@ -package api - -import ( - "embed" -) - -var ( - //go:embed swagger.yaml - swaggerDoc embed.FS -) - -type Response struct { - Code int `json:"code,omitempty"` - Msg string `json:"msg,omitempty"` -} diff --git a/pkg/api/config.go b/pkg/api/config.go deleted file mode 100644 index 6d4b2bf..0000000 --- a/pkg/api/config.go +++ /dev/null @@ -1,118 +0,0 @@ -package api - -import ( - "bytes" - "fmt" - "net/http" - "os" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" -) - -// swagger:parameters getConfigRequest -type getConfigRequest struct { - // output format, one of yaml|json, default is json. - // in: query - Format string `form:"format" json:"format"` -} - -// successful operation. -// swagger:response getConfigResponse -type getConfigResponse struct { - Config *config.Config -} - -func getConfig(ctx *gin.Context) { - // swagger:route GET /config ConfigManagement getConfigRequest - // - // Get current config. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: getConfigResponse - - var req getConfigRequest - ctx.ShouldBindQuery(&req) - - var resp getConfigResponse - resp.Config = config.Global() - - buf := &bytes.Buffer{} - switch req.Format { - case "yaml": - default: - req.Format = "json" - } - - resp.Config.Write(buf, req.Format) - - contentType := "application/json" - if req.Format == "yaml" { - contentType = "text/x-yaml" - } - - ctx.Data(http.StatusOK, contentType, buf.Bytes()) -} - -// swagger:parameters saveConfigRequest -type saveConfigRequest struct { - // output format, one of yaml|json, default is yaml. - // in: query - Format string `form:"format" json:"format"` -} - -// successful operation. -// swagger:response saveConfigResponse -type saveConfigResponse struct { - Data Response -} - -func saveConfig(ctx *gin.Context) { - // swagger:route POST /config ConfigManagement saveConfigRequest - // - // Save current config to file (gost.yaml or gost.json). - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: saveConfigResponse - - var req saveConfigRequest - ctx.ShouldBindQuery(&req) - - file := "gost.yaml" - switch req.Format { - case "json": - file = "gost.json" - default: - req.Format = "yaml" - } - - f, err := os.Create(file) - if err != nil { - writeError(ctx, &Error{ - statusCode: http.StatusInternalServerError, - Code: 40005, - Msg: fmt.Sprintf("create file: %s", err.Error()), - }) - return - } - defer f.Close() - - if err := config.Global().Write(f, req.Format); err != nil { - writeError(ctx, &Error{ - statusCode: http.StatusInternalServerError, - Code: 40006, - Msg: fmt.Sprintf("write: %s", err.Error()), - }) - return - } - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_admission.go b/pkg/api/config_admission.go deleted file mode 100644 index 77d4cad..0000000 --- a/pkg/api/config_admission.go +++ /dev/null @@ -1,166 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createAdmissionRequest -type createAdmissionRequest struct { - // in: body - Data config.AdmissionConfig `json:"data"` -} - -// successful operation. -// swagger:response createAdmissionResponse -type createAdmissionResponse struct { - Data Response -} - -func createAdmission(ctx *gin.Context) { - // swagger:route POST /config/admissions ConfigManagement createAdmissionRequest - // - // Create a new admission, the name of admission must be unique in admission list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createAdmissionResponse - - var req createAdmissionRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v := parsing.ParseAdmission(&req.Data) - - if err := registry.AdmissionRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Admissions = append(cfg.Admissions, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateAdmissionRequest -type updateAdmissionRequest struct { - // in: path - // required: true - Admission string `uri:"admission" json:"admission"` - // in: body - Data config.AdmissionConfig `json:"data"` -} - -// successful operation. -// swagger:response updateAdmissionResponse -type updateAdmissionResponse struct { - Data Response -} - -func updateAdmission(ctx *gin.Context) { - // swagger:route PUT /config/admissions/{admission} ConfigManagement updateAdmissionRequest - // - // Update admission by name, the admission must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateAdmissionResponse - - var req updateAdmissionRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.AdmissionRegistry().IsRegistered(req.Admission) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Admission - - v := parsing.ParseAdmission(&req.Data) - - registry.AdmissionRegistry().Unregister(req.Admission) - - if err := registry.AdmissionRegistry().Register(req.Admission, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Admissions { - if cfg.Admissions[i].Name == req.Admission { - cfg.Admissions[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteAdmissionRequest -type deleteAdmissionRequest struct { - // in: path - // required: true - Admission string `uri:"admission" json:"admission"` -} - -// successful operation. -// swagger:response deleteAdmissionResponse -type deleteAdmissionResponse struct { - Data Response -} - -func deleteAdmission(ctx *gin.Context) { - // swagger:route DELETE /config/admissions/{admission} ConfigManagement deleteAdmissionRequest - // - // Delete admission by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteAdmissionResponse - - var req deleteAdmissionRequest - ctx.ShouldBindUri(&req) - - if !registry.AdmissionRegistry().IsRegistered(req.Admission) { - writeError(ctx, ErrNotFound) - return - } - registry.AdmissionRegistry().Unregister(req.Admission) - - cfg := config.Global() - admissiones := cfg.Admissions - cfg.Admissions = nil - for _, s := range admissiones { - if s.Name == req.Admission { - continue - } - cfg.Admissions = append(cfg.Admissions, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_auther.go b/pkg/api/config_auther.go deleted file mode 100644 index ee2a4b9..0000000 --- a/pkg/api/config_auther.go +++ /dev/null @@ -1,164 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createAutherRequest -type createAutherRequest struct { - // in: body - Data config.AutherConfig `json:"data"` -} - -// successful operation. -// swagger:response createAutherResponse -type createAutherResponse struct { - Data Response -} - -func createAuther(ctx *gin.Context) { - // swagger:route POST /config/authers ConfigManagement createAutherRequest - // - // Create a new auther, the name of the auther must be unique in auther list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createAutherResponse - - var req createAutherRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v := parsing.ParseAuther(&req.Data) - if err := registry.AutherRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Authers = append(cfg.Authers, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateAutherRequest -type updateAutherRequest struct { - // in: path - // required: true - Auther string `uri:"auther" json:"auther"` - // in: body - Data config.AutherConfig `json:"data"` -} - -// successful operation. -// swagger:response updateAutherResponse -type updateAutherResponse struct { - Data Response -} - -func updateAuther(ctx *gin.Context) { - // swagger:route PUT /config/authers/{auther} ConfigManagement updateAutherRequest - // - // Update auther by name, the auther must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateAutherResponse - - var req updateAutherRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.AutherRegistry().IsRegistered(req.Auther) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Auther - - v := parsing.ParseAuther(&req.Data) - registry.AutherRegistry().Unregister(req.Auther) - - if err := registry.AutherRegistry().Register(req.Auther, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Authers { - if cfg.Authers[i].Name == req.Auther { - cfg.Authers[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteAutherRequest -type deleteAutherRequest struct { - // in: path - // required: true - Auther string `uri:"auther" json:"auther"` -} - -// successful operation. -// swagger:response deleteAutherResponse -type deleteAutherResponse struct { - Data Response -} - -func deleteAuther(ctx *gin.Context) { - // swagger:route DELETE /config/authers/{auther} ConfigManagement deleteAutherRequest - // - // Delete auther by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteAutherResponse - - var req deleteAutherRequest - ctx.ShouldBindUri(&req) - - if !registry.AutherRegistry().IsRegistered(req.Auther) { - writeError(ctx, ErrNotFound) - return - } - registry.AutherRegistry().Unregister(req.Auther) - - cfg := config.Global() - authers := cfg.Authers - cfg.Authers = nil - for _, s := range authers { - if s.Name == req.Auther { - continue - } - cfg.Authers = append(cfg.Authers, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_bypass.go b/pkg/api/config_bypass.go deleted file mode 100644 index f84c849..0000000 --- a/pkg/api/config_bypass.go +++ /dev/null @@ -1,166 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createBypassRequest -type createBypassRequest struct { - // in: body - Data config.BypassConfig `json:"data"` -} - -// successful operation. -// swagger:response createBypassResponse -type createBypassResponse struct { - Data Response -} - -func createBypass(ctx *gin.Context) { - // swagger:route POST /config/bypasses ConfigManagement createBypassRequest - // - // Create a new bypass, the name of bypass must be unique in bypass list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createBypassResponse - - var req createBypassRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v := parsing.ParseBypass(&req.Data) - - if err := registry.BypassRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Bypasses = append(cfg.Bypasses, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateBypassRequest -type updateBypassRequest struct { - // in: path - // required: true - Bypass string `uri:"bypass" json:"bypass"` - // in: body - Data config.BypassConfig `json:"data"` -} - -// successful operation. -// swagger:response updateBypassResponse -type updateBypassResponse struct { - Data Response -} - -func updateBypass(ctx *gin.Context) { - // swagger:route PUT /config/bypasses/{bypass} ConfigManagement updateBypassRequest - // - // Update bypass by name, the bypass must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateBypassResponse - - var req updateBypassRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.BypassRegistry().IsRegistered(req.Bypass) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Bypass - - v := parsing.ParseBypass(&req.Data) - - registry.BypassRegistry().Unregister(req.Bypass) - - if err := registry.BypassRegistry().Register(req.Bypass, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Bypasses { - if cfg.Bypasses[i].Name == req.Bypass { - cfg.Bypasses[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteBypassRequest -type deleteBypassRequest struct { - // in: path - // required: true - Bypass string `uri:"bypass" json:"bypass"` -} - -// successful operation. -// swagger:response deleteBypassResponse -type deleteBypassResponse struct { - Data Response -} - -func deleteBypass(ctx *gin.Context) { - // swagger:route DELETE /config/bypasses/{bypass} ConfigManagement deleteBypassRequest - // - // Delete bypass by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteBypassResponse - - var req deleteBypassRequest - ctx.ShouldBindUri(&req) - - if !registry.BypassRegistry().IsRegistered(req.Bypass) { - writeError(ctx, ErrNotFound) - return - } - registry.BypassRegistry().Unregister(req.Bypass) - - cfg := config.Global() - bypasses := cfg.Bypasses - cfg.Bypasses = nil - for _, s := range bypasses { - if s.Name == req.Bypass { - continue - } - cfg.Bypasses = append(cfg.Bypasses, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_chain.go b/pkg/api/config_chain.go deleted file mode 100644 index 2e4777d..0000000 --- a/pkg/api/config_chain.go +++ /dev/null @@ -1,175 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createChainRequest -type createChainRequest struct { - // in: body - Data config.ChainConfig `json:"data"` -} - -// successful operation. -// swagger:response createChainResponse -type createChainResponse struct { - Data Response -} - -func createChain(ctx *gin.Context) { - // swagger:route POST /config/chains ConfigManagement createChainRequest - // - // Create a new chain, the name of chain must be unique in chain list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createChainResponse - - var req createChainRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v, err := parsing.ParseChain(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - if err := registry.ChainRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Chains = append(cfg.Chains, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateChainRequest -type updateChainRequest struct { - // in: path - // required: true - // chain name - Chain string `uri:"chain" json:"chain"` - // in: body - Data config.ChainConfig `json:"data"` -} - -// successful operation. -// swagger:response updateChainResponse -type updateChainResponse struct { - Data Response -} - -func updateChain(ctx *gin.Context) { - // swagger:route PUT /config/chains/{chain} ConfigManagement updateChainRequest - // - // Update chain by name, the chain must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateChainResponse - - var req updateChainRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.ChainRegistry().IsRegistered(req.Chain) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Chain - - v, err := parsing.ParseChain(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - registry.ChainRegistry().Unregister(req.Chain) - - if err := registry.ChainRegistry().Register(req.Chain, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Chains { - if cfg.Chains[i].Name == req.Chain { - cfg.Chains[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteChainRequest -type deleteChainRequest struct { - // in: path - // required: true - Chain string `uri:"chain" json:"chain"` -} - -// successful operation. -// swagger:response deleteChainResponse -type deleteChainResponse struct { - Data Response -} - -func deleteChain(ctx *gin.Context) { - // swagger:route DELETE /config/chains/{chain} ConfigManagement deleteChainRequest - // - // Delete chain by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteChainResponse - - var req deleteChainRequest - ctx.ShouldBindUri(&req) - - if !registry.ChainRegistry().IsRegistered(req.Chain) { - writeError(ctx, ErrNotFound) - return - } - registry.ChainRegistry().Unregister(req.Chain) - - cfg := config.Global() - chains := cfg.Chains - cfg.Chains = nil - for _, s := range chains { - if s.Name == req.Chain { - continue - } - cfg.Chains = append(cfg.Chains, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_hosts.go b/pkg/api/config_hosts.go deleted file mode 100644 index 4318b3c..0000000 --- a/pkg/api/config_hosts.go +++ /dev/null @@ -1,166 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createHostsRequest -type createHostsRequest struct { - // in: body - Data config.HostsConfig `json:"data"` -} - -// successful operation. -// swagger:response createHostsResponse -type createHostsesponse struct { - Data Response -} - -func createHosts(ctx *gin.Context) { - // swagger:route POST /config/hosts ConfigManagement createHostsRequest - // - // Create a new hosts, the name of the hosts must be unique in hosts list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createHostsResponse - - var req createHostsRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v := parsing.ParseHosts(&req.Data) - - if err := registry.HostsRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Hosts = append(cfg.Hosts, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateHostsRequest -type updateHostsRequest struct { - // in: path - // required: true - Hosts string `uri:"hosts" json:"hosts"` - // in: body - Data config.HostsConfig `json:"data"` -} - -// successful operation. -// swagger:response updateHostsResponse -type updateHostsResponse struct { - Data Response -} - -func updateHosts(ctx *gin.Context) { - // swagger:route PUT /config/hosts/{hosts} ConfigManagement updateHostsRequest - // - // Update hosts by name, the hosts must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateHostsResponse - - var req updateHostsRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.HostsRegistry().IsRegistered(req.Hosts) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Hosts - - v := parsing.ParseHosts(&req.Data) - - registry.HostsRegistry().Unregister(req.Hosts) - - if err := registry.HostsRegistry().Register(req.Hosts, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Hosts { - if cfg.Hosts[i].Name == req.Hosts { - cfg.Hosts[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteHostsRequest -type deleteHostsRequest struct { - // in: path - // required: true - Hosts string `uri:"hosts" json:"hosts"` -} - -// successful operation. -// swagger:response deleteHostsResponse -type deleteHostsResponse struct { - Data Response -} - -func deleteHosts(ctx *gin.Context) { - // swagger:route DELETE /config/hosts/{hosts} ConfigManagement deleteHostsRequest - // - // Delete hosts by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteHostsResponse - - var req deleteHostsRequest - ctx.ShouldBindUri(&req) - - if !registry.HostsRegistry().IsRegistered(req.Hosts) { - writeError(ctx, ErrNotFound) - return - } - registry.HostsRegistry().Unregister(req.Hosts) - - cfg := config.Global() - hosts := cfg.Hosts - cfg.Hosts = nil - for _, s := range hosts { - if s.Name == req.Hosts { - continue - } - cfg.Hosts = append(cfg.Hosts, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_resolver.go b/pkg/api/config_resolver.go deleted file mode 100644 index 7b7b695..0000000 --- a/pkg/api/config_resolver.go +++ /dev/null @@ -1,174 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createResolverRequest -type createResolverRequest struct { - // in: body - Data config.ResolverConfig `json:"data"` -} - -// successful operation. -// swagger:response createResolverResponse -type createResolverResponse struct { - Data Response -} - -func createResolver(ctx *gin.Context) { - // swagger:route POST /config/resolvers ConfigManagement createResolverRequest - // - // Create a new resolver, the name of the resolver must be unique in resolver list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createResolverResponse - - var req createResolverRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - v, err := parsing.ParseResolver(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - if err := registry.ResolverRegistry().Register(req.Data.Name, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - cfg.Resolvers = append(cfg.Resolvers, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateResolverRequest -type updateResolverRequest struct { - // in: path - // required: true - Resolver string `uri:"resolver" json:"resolver"` - // in: body - Data config.ResolverConfig `json:"data"` -} - -// successful operation. -// swagger:response updateResolverResponse -type updateResolverResponse struct { - Data Response -} - -func updateResolver(ctx *gin.Context) { - // swagger:route PUT /config/resolvers/{resolver} ConfigManagement updateResolverRequest - // - // Update resolver by name, the resolver must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateResolverResponse - - var req updateResolverRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - if !registry.ResolverRegistry().IsRegistered(req.Resolver) { - writeError(ctx, ErrNotFound) - return - } - - req.Data.Name = req.Resolver - - v, err := parsing.ParseResolver(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - registry.ResolverRegistry().Unregister(req.Resolver) - - if err := registry.ResolverRegistry().Register(req.Resolver, v); err != nil { - writeError(ctx, ErrDup) - return - } - - cfg := config.Global() - for i := range cfg.Resolvers { - if cfg.Resolvers[i].Name == req.Resolver { - cfg.Resolvers[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteResolverRequest -type deleteResolverRequest struct { - // in: path - // required: true - Resolver string `uri:"resolver" json:"resolver"` -} - -// successful operation. -// swagger:response deleteResolverResponse -type deleteResolverResponse struct { - Data Response -} - -func deleteResolver(ctx *gin.Context) { - // swagger:route DELETE /config/resolvers/{resolver} ConfigManagement deleteResolverRequest - // - // Delete resolver by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteResolverResponse - - var req deleteResolverRequest - ctx.ShouldBindUri(&req) - - if !registry.ResolverRegistry().IsRegistered(req.Resolver) { - writeError(ctx, ErrNotFound) - return - } - registry.ResolverRegistry().Unregister(req.Resolver) - - cfg := config.Global() - resolvers := cfg.Resolvers - cfg.Resolvers = nil - for _, s := range resolvers { - if s.Name == req.Resolver { - continue - } - cfg.Resolvers = append(cfg.Resolvers, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/config_service.go b/pkg/api/config_service.go deleted file mode 100644 index 74a0b6b..0000000 --- a/pkg/api/config_service.go +++ /dev/null @@ -1,190 +0,0 @@ -package api - -import ( - "net/http" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/config/parsing" - "github.com/go-gost/gost/v3/pkg/registry" -) - -// swagger:parameters createServiceRequest -type createServiceRequest struct { - // in: body - Data config.ServiceConfig `json:"data"` -} - -// successful operation. -// swagger:response createServiceResponse -type createServiceResponse struct { - Data Response -} - -func createService(ctx *gin.Context) { - // swagger:route POST /config/services ConfigManagement createServiceRequest - // - // Create a new service, the name of the service must be unique in service list. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: createServiceResponse - - var req createServiceRequest - ctx.ShouldBindJSON(&req.Data) - - if req.Data.Name == "" { - writeError(ctx, ErrInvalid) - return - } - - if registry.ServiceRegistry().IsRegistered(req.Data.Name) { - writeError(ctx, ErrDup) - return - } - - svc, err := parsing.ParseService(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - if err := registry.ServiceRegistry().Register(req.Data.Name, svc); err != nil { - svc.Close() - writeError(ctx, ErrDup) - return - } - - go svc.Serve() - - cfg := config.Global() - cfg.Services = append(cfg.Services, &req.Data) - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters updateServiceRequest -type updateServiceRequest struct { - // in: path - // required: true - Service string `uri:"service" json:"service"` - // in: body - Data config.ServiceConfig `json:"data"` -} - -// successful operation. -// swagger:response updateServiceResponse -type updateServiceResponse struct { - Data Response -} - -func updateService(ctx *gin.Context) { - // swagger:route PUT /config/services/{service} ConfigManagement updateServiceRequest - // - // Update service by name, the service must already exist. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: updateServiceResponse - - var req updateServiceRequest - ctx.ShouldBindUri(&req) - ctx.ShouldBindJSON(&req.Data) - - old := registry.ServiceRegistry().Get(req.Service) - if old == nil { - writeError(ctx, ErrNotFound) - return - } - old.Close() - - req.Data.Name = req.Service - - svc, err := parsing.ParseService(&req.Data) - if err != nil { - writeError(ctx, ErrCreate) - return - } - - registry.ServiceRegistry().Unregister(req.Service) - - if err := registry.ServiceRegistry().Register(req.Service, svc); err != nil { - svc.Close() - writeError(ctx, ErrDup) - return - } - - go svc.Serve() - - cfg := config.Global() - for i := range cfg.Services { - if cfg.Services[i].Name == req.Service { - cfg.Services[i] = &req.Data - break - } - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} - -// swagger:parameters deleteServiceRequest -type deleteServiceRequest struct { - // in: path - // required: true - Service string `uri:"service" json:"service"` -} - -// successful operation. -// swagger:response deleteServiceResponse -type deleteServiceResponse struct { - Data Response -} - -func deleteService(ctx *gin.Context) { - // swagger:route DELETE /config/services/{service} ConfigManagement deleteServiceRequest - // - // Delete service by name. - // - // Security: - // basicAuth: [] - // - // Responses: - // 200: deleteServiceResponse - - var req deleteServiceRequest - ctx.ShouldBindUri(&req) - - svc := registry.ServiceRegistry().Get(req.Service) - if svc == nil { - writeError(ctx, ErrNotFound) - return - } - - registry.ServiceRegistry().Unregister(req.Service) - svc.Close() - - cfg := config.Global() - services := cfg.Services - cfg.Services = nil - for _, s := range services { - if s.Name == req.Service { - continue - } - cfg.Services = append(cfg.Services, s) - } - config.SetGlobal(cfg) - - ctx.JSON(http.StatusOK, Response{ - Msg: "OK", - }) -} diff --git a/pkg/api/doc.go b/pkg/api/doc.go deleted file mode 100644 index a2bfb2e..0000000 --- a/pkg/api/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Documentation of Web API. -// -// Schemes: https, http -// BasePath: / -// Version: 1.0.0 -// -// Consumes: -// - application/json -// -// Produces: -// - application/json -// -// SecurityDefinitions: -// basicAuth: -// type: basic -// -// swagger:meta -package api diff --git a/pkg/api/error.go b/pkg/api/error.go deleted file mode 100644 index 8fdc3f9..0000000 --- a/pkg/api/error.go +++ /dev/null @@ -1,45 +0,0 @@ -package api - -import ( - "encoding/json" - "net/http" - - "github.com/gin-gonic/gin" -) - -var ( - ErrInvalid = &Error{statusCode: http.StatusBadRequest, Code: 40001, Msg: "object invalid"} - ErrDup = &Error{statusCode: http.StatusBadRequest, Code: 40002, Msg: "object duplicated"} - ErrCreate = &Error{statusCode: http.StatusConflict, Code: 40003, Msg: "object creation failed"} - ErrNotFound = &Error{statusCode: http.StatusBadRequest, Code: 40004, Msg: "object not found"} - ErrSave = &Error{statusCode: http.StatusInternalServerError, Code: 40005, Msg: "save config failed"} -) - -// Error is an api error. -type Error struct { - statusCode int - Code int `json:"code"` - Msg string `json:"msg"` -} - -func (e *Error) Error() string { - b, _ := json.Marshal(e) - return string(b) -} - -func writeError(c *gin.Context, err error) { - // c.Set(HTTPResponseTag, err) - c.JSON(getStatusCode(err), err) -} - -func getStatusCode(err error) int { - if err == nil { - return http.StatusOK - } - if e, ok := err.(*Error); ok { - if e.statusCode >= http.StatusOK && e.statusCode < 600 { - return e.statusCode - } - } - return http.StatusInternalServerError -} diff --git a/pkg/api/middleware.go b/pkg/api/middleware.go deleted file mode 100644 index 469124c..0000000 --- a/pkg/api/middleware.go +++ /dev/null @@ -1,42 +0,0 @@ -package api - -import ( - "net/http" - "time" - - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/auth" - "github.com/go-gost/gost/v3/pkg/logger" -) - -func mwLogger() gin.HandlerFunc { - return func(ctx *gin.Context) { - // start time - startTime := time.Now() - // Processing request - ctx.Next() - duration := time.Since(startTime) - - logger.Default().WithFields(map[string]any{ - "kind": "api", - "method": ctx.Request.Method, - "uri": ctx.Request.RequestURI, - "code": ctx.Writer.Status(), - "client": ctx.ClientIP(), - "duration": duration, - }).Infof("| %3d | %13v | %15s | %-7s %s", - ctx.Writer.Status(), duration, ctx.ClientIP(), ctx.Request.Method, ctx.Request.RequestURI) - } -} - -func mwBasicAuth(auther auth.Authenticator) gin.HandlerFunc { - return func(c *gin.Context) { - if auther == nil { - return - } - u, p, _ := c.Request.BasicAuth() - if !auther.Authenticate(u, p) { - c.AbortWithStatus(http.StatusUnauthorized) - } - } -} diff --git a/pkg/api/service.go b/pkg/api/service.go deleted file mode 100644 index f0cdee1..0000000 --- a/pkg/api/service.go +++ /dev/null @@ -1,132 +0,0 @@ -package api - -import ( - "net" - "net/http" - - "github.com/gin-contrib/cors" - "github.com/gin-gonic/gin" - "github.com/go-gost/gost/v3/pkg/auth" - "github.com/go-gost/gost/v3/pkg/service" -) - -type options struct { - accessLog bool - pathPrefix string - auther auth.Authenticator -} - -type Option func(*options) - -func PathPrefixOption(pathPrefix string) Option { - return func(o *options) { - o.pathPrefix = pathPrefix - } -} - -func AccessLogOption(enable bool) Option { - return func(o *options) { - o.accessLog = enable - } -} - -func AutherOption(auther auth.Authenticator) Option { - return func(o *options) { - o.auther = auther - } -} - -type server struct { - s *http.Server - ln net.Listener -} - -func NewService(addr string, opts ...Option) (service.Service, error) { - ln, err := net.Listen("tcp", addr) - if err != nil { - return nil, err - } - - var options options - for _, opt := range opts { - opt(&options) - } - - gin.SetMode(gin.ReleaseMode) - - r := gin.New() - r.Use( - cors.New((cors.Config{ - AllowAllOrigins: true, - AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"}, - AllowHeaders: []string{"*"}, - })), - gin.Recovery(), - ) - if options.accessLog { - r.Use(mwLogger()) - } - - router := r.Group("") - if options.pathPrefix != "" { - router = router.Group(options.pathPrefix) - } - - router.StaticFS("/docs", http.FS(swaggerDoc)) - - config := router.Group("/config") - config.Use(mwBasicAuth(options.auther)) - registerConfig(config) - - return &server{ - s: &http.Server{ - Handler: r, - }, - ln: ln, - }, nil -} - -func (s *server) Serve() error { - return s.s.Serve(s.ln) -} - -func (s *server) Addr() net.Addr { - return s.ln.Addr() -} - -func (s *server) Close() error { - return s.s.Close() -} - -func registerConfig(config *gin.RouterGroup) { - config.GET("", getConfig) - config.POST("", saveConfig) - - config.POST("/services", createService) - config.PUT("/services/:service", updateService) - config.DELETE("/services/:service", deleteService) - - config.POST("/chains", createChain) - config.PUT("/chains/:chain", updateChain) - config.DELETE("/chains/:chain", deleteChain) - - config.POST("/authers", createAuther) - config.PUT("/authers/:auther", updateAuther) - config.DELETE("/authers/:auther", deleteAuther) - - config.POST("/admissions", createAdmission) - config.PUT("/admissions/:admission", updateAdmission) - config.DELETE("/admissions/:admission", deleteAdmission) - - config.POST("/bypasses", createBypass) - config.PUT("/bypasses/:bypass", updateBypass) - config.DELETE("/bypasses/:bypass", deleteBypass) - - config.POST("/resolvers", createResolver) - config.PUT("/resolvers/:resolver", updateResolver) - config.DELETE("/resolvers/:resolver", deleteResolver) - - config.POST("/hosts", createHosts) - config.PUT("/hosts/:hosts", updateHosts) - config.DELETE("/hosts/:hosts", deleteHosts) -} diff --git a/pkg/api/swagger.yaml b/pkg/api/swagger.yaml deleted file mode 100644 index d0d1ae2..0000000 --- a/pkg/api/swagger.yaml +++ /dev/null @@ -1,1068 +0,0 @@ -basePath: / -consumes: -- application/json -definitions: - APIConfig: - properties: - accesslog: - type: boolean - x-go-name: AccessLog - addr: - type: string - x-go-name: Addr - auth: - $ref: '#/definitions/AuthConfig' - auther: - type: string - x-go-name: Auther - pathPrefix: - type: string - x-go-name: PathPrefix - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - AdmissionConfig: - properties: - matchers: - items: - type: string - type: array - x-go-name: Matchers - name: - type: string - x-go-name: Name - reverse: - type: boolean - x-go-name: Reverse - type: - description: inline, file, etc. - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - AuthConfig: - properties: - password: - type: string - x-go-name: Password - username: - type: string - x-go-name: Username - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - AutherConfig: - properties: - auths: - items: - $ref: '#/definitions/AuthConfig' - type: array - x-go-name: Auths - name: - type: string - x-go-name: Name - type: - description: inline, file, redis, etc. - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - BypassConfig: - properties: - matchers: - items: - type: string - type: array - x-go-name: Matchers - name: - type: string - x-go-name: Name - reverse: - type: boolean - x-go-name: Reverse - type: - description: inline, file, etc. - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ChainConfig: - properties: - hops: - items: - $ref: '#/definitions/HopConfig' - type: array - x-go-name: Hops - name: - type: string - x-go-name: Name - selector: - $ref: '#/definitions/SelectorConfig' - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - Config: - properties: - admissions: - items: - $ref: '#/definitions/AdmissionConfig' - type: array - x-go-name: Admissions - api: - $ref: '#/definitions/APIConfig' - authers: - items: - $ref: '#/definitions/AutherConfig' - type: array - x-go-name: Authers - bypasses: - items: - $ref: '#/definitions/BypassConfig' - type: array - x-go-name: Bypasses - chains: - items: - $ref: '#/definitions/ChainConfig' - type: array - x-go-name: Chains - hosts: - items: - $ref: '#/definitions/HostsConfig' - type: array - x-go-name: Hosts - log: - $ref: '#/definitions/LogConfig' - metrics: - $ref: '#/definitions/MetricsConfig' - profiling: - $ref: '#/definitions/ProfilingConfig' - resolvers: - items: - $ref: '#/definitions/ResolverConfig' - type: array - x-go-name: Resolvers - services: - items: - $ref: '#/definitions/ServiceConfig' - type: array - x-go-name: Services - tls: - $ref: '#/definitions/TLSConfig' - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ConnectorConfig: - properties: - auth: - $ref: '#/definitions/AuthConfig' - metadata: - additionalProperties: - type: object - type: object - x-go-name: Metadata - tls: - $ref: '#/definitions/TLSConfig' - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - DialerConfig: - properties: - auth: - $ref: '#/definitions/AuthConfig' - metadata: - additionalProperties: - type: object - type: object - x-go-name: Metadata - tls: - $ref: '#/definitions/TLSConfig' - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - Duration: - description: |- - A Duration represents the elapsed time between two instants - as an int64 nanosecond count. The representation limits the - largest representable duration to approximately 290 years. - format: int64 - type: integer - x-go-package: time - ForwarderConfig: - properties: - selector: - $ref: '#/definitions/SelectorConfig' - targets: - items: - type: string - type: array - x-go-name: Targets - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - HandlerConfig: - properties: - auth: - $ref: '#/definitions/AuthConfig' - auther: - type: string - x-go-name: Auther - chain: - type: string - x-go-name: Chain - metadata: - additionalProperties: - type: object - type: object - x-go-name: Metadata - retries: - format: int64 - type: integer - x-go-name: Retries - tls: - $ref: '#/definitions/TLSConfig' - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - HopConfig: - properties: - bypass: - type: string - x-go-name: Bypass - hosts: - type: string - x-go-name: Hosts - name: - type: string - x-go-name: Name - nodes: - items: - $ref: '#/definitions/NodeConfig' - type: array - x-go-name: Nodes - resolver: - type: string - x-go-name: Resolver - selector: - $ref: '#/definitions/SelectorConfig' - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - HostMappingConfig: - properties: - aliases: - items: - type: string - type: array - x-go-name: Aliases - hostname: - type: string - x-go-name: Hostname - ip: - type: string - x-go-name: IP - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - HostsConfig: - properties: - mappings: - items: - $ref: '#/definitions/HostMappingConfig' - type: array - x-go-name: Mappings - name: - type: string - x-go-name: Name - type: - description: inline, file, etc. - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ListenerConfig: - properties: - auth: - $ref: '#/definitions/AuthConfig' - auther: - type: string - x-go-name: Auther - chain: - type: string - x-go-name: Chain - metadata: - additionalProperties: - type: object - type: object - x-go-name: Metadata - tls: - $ref: '#/definitions/TLSConfig' - type: - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - LogConfig: - properties: - format: - type: string - x-go-name: Format - level: - type: string - x-go-name: Level - output: - type: string - x-go-name: Output - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - MetricsConfig: - properties: - addr: - type: string - x-go-name: Addr - enable: - type: boolean - x-go-name: Enable - path: - type: string - x-go-name: Path - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - NameserverConfig: - properties: - addr: - type: string - x-go-name: Addr - chain: - type: string - x-go-name: Chain - clientIP: - type: string - x-go-name: ClientIP - hostname: - type: string - x-go-name: Hostname - prefer: - type: string - x-go-name: Prefer - timeout: - $ref: '#/definitions/Duration' - ttl: - $ref: '#/definitions/Duration' - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - NodeConfig: - properties: - addr: - type: string - x-go-name: Addr - bypass: - type: string - x-go-name: Bypass - connector: - $ref: '#/definitions/ConnectorConfig' - dialer: - $ref: '#/definitions/DialerConfig' - hosts: - type: string - x-go-name: Hosts - name: - type: string - x-go-name: Name - resolver: - type: string - x-go-name: Resolver - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ProfilingConfig: - properties: - addr: - type: string - x-go-name: Addr - enable: - type: boolean - x-go-name: Enable - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ResolverConfig: - properties: - name: - type: string - x-go-name: Name - nameservers: - items: - $ref: '#/definitions/NameserverConfig' - type: array - x-go-name: Nameservers - type: - description: inline, file, etc. - type: string - x-go-name: Type - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - Response: - properties: - code: - format: int64 - type: integer - x-go-name: Code - msg: - type: string - x-go-name: Msg - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/api - SelectorConfig: - properties: - failTimeout: - $ref: '#/definitions/Duration' - maxFails: - format: int64 - type: integer - x-go-name: MaxFails - strategy: - type: string - x-go-name: Strategy - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - ServiceConfig: - properties: - addr: - type: string - x-go-name: Addr - admission: - type: string - x-go-name: Admission - bypass: - type: string - x-go-name: Bypass - forwarder: - $ref: '#/definitions/ForwarderConfig' - handler: - $ref: '#/definitions/HandlerConfig' - hosts: - type: string - x-go-name: Hosts - listener: - $ref: '#/definitions/ListenerConfig' - name: - type: string - x-go-name: Name - resolver: - type: string - x-go-name: Resolver - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config - TLSConfig: - properties: - caFile: - type: string - x-go-name: CAFile - certFile: - type: string - x-go-name: CertFile - keyFile: - type: string - x-go-name: KeyFile - secure: - type: boolean - x-go-name: Secure - serverName: - type: string - x-go-name: ServerName - type: object - x-go-package: github.com/go-gost/gost/v3/pkg/config -info: - title: Documentation of Web API. - version: 1.0.0 -paths: - /config: - get: - operationId: getConfigRequest - parameters: - - description: output format, one of yaml|json, default is json. - in: query - name: format - type: string - x-go-name: Format - responses: - "200": - $ref: '#/responses/getConfigResponse' - security: - - basicAuth: - - '[]' - summary: Get current config. - tags: - - ConfigManagement - post: - operationId: saveConfigRequest - parameters: - - description: output format, one of yaml|json, default is yaml. - in: query - name: format - type: string - x-go-name: Format - responses: - "200": - $ref: '#/responses/saveConfigResponse' - security: - - basicAuth: - - '[]' - summary: Save current config to file (gost.yaml or gost.json). - tags: - - ConfigManagement - /config/admissions: - post: - operationId: createAdmissionRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/AdmissionConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createAdmissionResponse' - security: - - basicAuth: - - '[]' - summary: Create a new admission, the name of admission must be unique in admission - list. - tags: - - ConfigManagement - /config/admissions/{admission}: - delete: - operationId: deleteAdmissionRequest - parameters: - - in: path - name: admission - required: true - type: string - x-go-name: Admission - responses: - "200": - $ref: '#/responses/deleteAdmissionResponse' - security: - - basicAuth: - - '[]' - summary: Delete admission by name. - tags: - - ConfigManagement - put: - operationId: updateAdmissionRequest - parameters: - - in: path - name: admission - required: true - type: string - x-go-name: Admission - - in: body - name: data - schema: - $ref: '#/definitions/AdmissionConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateAdmissionResponse' - security: - - basicAuth: - - '[]' - summary: Update admission by name, the admission must already exist. - tags: - - ConfigManagement - /config/authers: - post: - operationId: createAutherRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/AutherConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createAutherResponse' - security: - - basicAuth: - - '[]' - summary: Create a new auther, the name of the auther must be unique in auther - list. - tags: - - ConfigManagement - /config/authers/{auther}: - delete: - operationId: deleteAutherRequest - parameters: - - in: path - name: auther - required: true - type: string - x-go-name: Auther - responses: - "200": - $ref: '#/responses/deleteAutherResponse' - security: - - basicAuth: - - '[]' - summary: Delete auther by name. - tags: - - ConfigManagement - put: - operationId: updateAutherRequest - parameters: - - in: path - name: auther - required: true - type: string - x-go-name: Auther - - in: body - name: data - schema: - $ref: '#/definitions/AutherConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateAutherResponse' - security: - - basicAuth: - - '[]' - summary: Update auther by name, the auther must already exist. - tags: - - ConfigManagement - /config/bypasses: - post: - operationId: createBypassRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/BypassConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createBypassResponse' - security: - - basicAuth: - - '[]' - summary: Create a new bypass, the name of bypass must be unique in bypass list. - tags: - - ConfigManagement - /config/bypasses/{bypass}: - delete: - operationId: deleteBypassRequest - parameters: - - in: path - name: bypass - required: true - type: string - x-go-name: Bypass - responses: - "200": - $ref: '#/responses/deleteBypassResponse' - security: - - basicAuth: - - '[]' - summary: Delete bypass by name. - tags: - - ConfigManagement - put: - operationId: updateBypassRequest - parameters: - - in: path - name: bypass - required: true - type: string - x-go-name: Bypass - - in: body - name: data - schema: - $ref: '#/definitions/BypassConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateBypassResponse' - security: - - basicAuth: - - '[]' - summary: Update bypass by name, the bypass must already exist. - tags: - - ConfigManagement - /config/chains: - post: - operationId: createChainRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/ChainConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createChainResponse' - security: - - basicAuth: - - '[]' - summary: Create a new chain, the name of chain must be unique in chain list. - tags: - - ConfigManagement - /config/chains/{chain}: - delete: - operationId: deleteChainRequest - parameters: - - in: path - name: chain - required: true - type: string - x-go-name: Chain - responses: - "200": - $ref: '#/responses/deleteChainResponse' - security: - - basicAuth: - - '[]' - summary: Delete chain by name. - tags: - - ConfigManagement - put: - operationId: updateChainRequest - parameters: - - in: path - name: chain - required: true - type: string - x-go-name: Chain - - in: body - name: data - schema: - $ref: '#/definitions/ChainConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateChainResponse' - security: - - basicAuth: - - '[]' - summary: Update chain by name, the chain must already exist. - tags: - - ConfigManagement - /config/hosts: - post: - operationId: createHostsRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/HostsConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createHostsResponse' - security: - - basicAuth: - - '[]' - summary: Create a new hosts, the name of the hosts must be unique in hosts list. - tags: - - ConfigManagement - /config/hosts/{hosts}: - delete: - operationId: deleteHostsRequest - parameters: - - in: path - name: hosts - required: true - type: string - x-go-name: Hosts - responses: - "200": - $ref: '#/responses/deleteHostsResponse' - security: - - basicAuth: - - '[]' - summary: Delete hosts by name. - tags: - - ConfigManagement - put: - operationId: updateHostsRequest - parameters: - - in: path - name: hosts - required: true - type: string - x-go-name: Hosts - - in: body - name: data - schema: - $ref: '#/definitions/HostsConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateHostsResponse' - security: - - basicAuth: - - '[]' - summary: Update hosts by name, the hosts must already exist. - tags: - - ConfigManagement - /config/resolvers: - post: - operationId: createResolverRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/ResolverConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createResolverResponse' - security: - - basicAuth: - - '[]' - summary: Create a new resolver, the name of the resolver must be unique in resolver - list. - tags: - - ConfigManagement - /config/resolvers/{resolver}: - delete: - operationId: deleteResolverRequest - parameters: - - in: path - name: resolver - required: true - type: string - x-go-name: Resolver - responses: - "200": - $ref: '#/responses/deleteResolverResponse' - security: - - basicAuth: - - '[]' - summary: Delete resolver by name. - tags: - - ConfigManagement - put: - operationId: updateResolverRequest - parameters: - - in: path - name: resolver - required: true - type: string - x-go-name: Resolver - - in: body - name: data - schema: - $ref: '#/definitions/ResolverConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateResolverResponse' - security: - - basicAuth: - - '[]' - summary: Update resolver by name, the resolver must already exist. - tags: - - ConfigManagement - /config/services: - post: - operationId: createServiceRequest - parameters: - - in: body - name: data - schema: - $ref: '#/definitions/ServiceConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/createServiceResponse' - security: - - basicAuth: - - '[]' - summary: Create a new service, the name of the service must be unique in service - list. - tags: - - ConfigManagement - /config/services/{service}: - delete: - operationId: deleteServiceRequest - parameters: - - in: path - name: service - required: true - type: string - x-go-name: Service - responses: - "200": - $ref: '#/responses/deleteServiceResponse' - security: - - basicAuth: - - '[]' - summary: Delete service by name. - tags: - - ConfigManagement - put: - operationId: updateServiceRequest - parameters: - - in: path - name: service - required: true - type: string - x-go-name: Service - - in: body - name: data - schema: - $ref: '#/definitions/ServiceConfig' - x-go-name: Data - responses: - "200": - $ref: '#/responses/updateServiceResponse' - security: - - basicAuth: - - '[]' - summary: Update service by name, the service must already exist. - tags: - - ConfigManagement -produces: -- application/json -responses: - createAdmissionResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createAutherResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createBypassResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createChainResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createHostsResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createResolverResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - createServiceResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteAdmissionResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteAutherResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteBypassResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteChainResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteHostsResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteResolverResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - deleteServiceResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - getConfigResponse: - description: successful operation. - headers: - Config: {} - schema: - $ref: '#/definitions/Config' - saveConfigResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateAdmissionResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateAutherResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateBypassResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateChainResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateHostsResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateResolverResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' - updateServiceResponse: - description: successful operation. - headers: - Data: {} - schema: - $ref: '#/definitions/Response' -schemes: -- https -- http -securityDefinitions: - basicAuth: - type: basic -swagger: "2.0" diff --git a/pkg/config/config.go b/pkg/config/config.go deleted file mode 100644 index 7fc1b72..0000000 --- a/pkg/config/config.go +++ /dev/null @@ -1,275 +0,0 @@ -package config - -import ( - "encoding/json" - "io" - "sync" - "time" - - "github.com/spf13/viper" - "gopkg.in/yaml.v2" -) - -var ( - v = viper.GetViper() -) - -func init() { - v.SetConfigName("gost") - v.AddConfigPath("/etc/gost/") - v.AddConfigPath("$HOME/.gost/") - v.AddConfigPath(".") -} - -var ( - global = &Config{} - globalMux sync.RWMutex -) - -func Global() *Config { - globalMux.RLock() - defer globalMux.RUnlock() - - cfg := &Config{} - *cfg = *global - return cfg -} - -func SetGlobal(c *Config) { - globalMux.Lock() - defer globalMux.Unlock() - - global = c -} - -type LogConfig struct { - Output string `yaml:",omitempty" json:"output,omitempty"` - Level string `yaml:",omitempty" json:"level,omitempty"` - Format string `yaml:",omitempty" json:"format,omitempty"` -} - -type ProfilingConfig struct { - Addr string `json:"addr"` - Enable bool `json:"enable"` -} - -type APIConfig struct { - Addr string `json:"addr"` - PathPrefix string `yaml:"pathPrefix,omitempty" json:"pathPrefix,omitempty"` - AccessLog bool `yaml:"accesslog,omitempty" json:"accesslog,omitempty"` - Auth *AuthConfig `yaml:",omitempty" json:"auth,omitempty"` - Auther string `yaml:",omitempty" json:"auther,omitempty"` -} - -type MetricsConfig struct { - Enable bool `json:"enable"` - Addr string `json:"addr"` - Path string `json:"path"` -} - -type TLSConfig struct { - CertFile string `yaml:"certFile,omitempty" json:"certFile,omitempty"` - KeyFile string `yaml:"keyFile,omitempty" json:"keyFile,omitempty"` - CAFile string `yaml:"caFile,omitempty" json:"caFile,omitempty"` - Secure bool `yaml:",omitempty" json:"secure,omitempty"` - ServerName string `yaml:"serverName,omitempty" json:"serverName,omitempty"` -} - -type AutherConfig struct { - Name string `json:"name"` - // inline, file, redis, etc. - Type string `yaml:",omitempty" json:"type,omitempty"` - Auths []*AuthConfig `yaml:",omitempty" json:"auths"` - // File string `yaml:",omitempty" json:"file"` -} - -type AuthConfig struct { - Username string `json:"username"` - Password string `yaml:",omitempty" json:"password,omitempty"` -} - -type SelectorConfig struct { - Strategy string `json:"strategy"` - MaxFails int `yaml:"maxFails" json:"maxFails"` - FailTimeout time.Duration `yaml:"failTimeout" json:"failTimeout"` -} - -type AdmissionConfig struct { - Name string `json:"name"` - // inline, file, etc. - Type string `yaml:",omitempty" json:"type,omitempty"` - Reverse bool `yaml:",omitempty" json:"reverse,omitempty"` - Matchers []string `json:"matchers"` -} - -type BypassConfig struct { - Name string `json:"name"` - // inline, file, etc. - Type string `yaml:",omitempty" json:"type,omitempty"` - Reverse bool `yaml:",omitempty" json:"reverse,omitempty"` - Matchers []string `json:"matchers"` -} - -type NameserverConfig struct { - Addr string `json:"addr"` - Chain string `yaml:",omitempty" json:"chain,omitempty"` - Prefer string `yaml:",omitempty" json:"prefer,omitempty"` - ClientIP string `yaml:"clientIP,omitempty" json:"clientIP,omitempty"` - Hostname string `yaml:",omitempty" json:"hostname,omitempty"` - TTL time.Duration `yaml:",omitempty" json:"ttl,omitempty"` - Timeout time.Duration `yaml:",omitempty" json:"timeout,omitempty"` -} - -type ResolverConfig struct { - Name string `json:"name"` - // inline, file, etc. - Type string `yaml:",omitempty" json:"type,omitempty"` - Nameservers []*NameserverConfig `json:"nameservers"` -} - -type HostMappingConfig struct { - IP string `json:"ip"` - Hostname string `json:"hostname"` - Aliases []string `yaml:",omitempty" json:"aliases,omitempty"` -} - -type HostsConfig struct { - Name string `json:"name"` - // inline, file, etc. - Type string `yaml:",omitempty" json:"type,omitempty"` - Mappings []*HostMappingConfig `json:"mappings"` -} - -type ListenerConfig struct { - Type string `json:"type"` - Chain string `yaml:",omitempty" json:"chain,omitempty"` - Auther string `yaml:",omitempty" json:"auther,omitempty"` - Auth *AuthConfig `yaml:",omitempty" json:"auth,omitempty"` - TLS *TLSConfig `yaml:",omitempty" json:"tls,omitempty"` - Metadata map[string]any `yaml:",omitempty" json:"metadata,omitempty"` -} - -type HandlerConfig struct { - Type string `json:"type"` - Retries int `yaml:",omitempty" json:"retries,omitempty"` - Chain string `yaml:",omitempty" json:"chain,omitempty"` - Auther string `yaml:",omitempty" json:"auther,omitempty"` - Auth *AuthConfig `yaml:",omitempty" json:"auth,omitempty"` - TLS *TLSConfig `yaml:",omitempty" json:"tls,omitempty"` - Metadata map[string]any `yaml:",omitempty" json:"metadata,omitempty"` -} - -type ForwarderConfig struct { - Targets []string `json:"targets"` - Selector *SelectorConfig `yaml:",omitempty" json:"selector,omitempty"` -} - -type DialerConfig struct { - Type string `json:"type"` - Auth *AuthConfig `yaml:",omitempty" json:"auth,omitempty"` - TLS *TLSConfig `yaml:",omitempty" json:"tls,omitempty"` - Metadata map[string]any `yaml:",omitempty" json:"metadata,omitempty"` -} - -type ConnectorConfig struct { - Type string `json:"type"` - Auth *AuthConfig `yaml:",omitempty" json:"auth,omitempty"` - TLS *TLSConfig `yaml:",omitempty" json:"tls,omitempty"` - Metadata map[string]any `yaml:",omitempty" json:"metadata,omitempty"` -} - -type ServiceConfig struct { - Name string `json:"name"` - Addr string `yaml:",omitempty" json:"addr,omitempty"` - Interface string `yaml:",omitempty" json:"interface,omitempty"` - Admission string `yaml:",omitempty" json:"admission,omitempty"` - Bypass string `yaml:",omitempty" json:"bypass,omitempty"` - Resolver string `yaml:",omitempty" json:"resolver,omitempty"` - Hosts string `yaml:",omitempty" json:"hosts,omitempty"` - Handler *HandlerConfig `yaml:",omitempty" json:"handler,omitempty"` - Listener *ListenerConfig `yaml:",omitempty" json:"listener,omitempty"` - Forwarder *ForwarderConfig `yaml:",omitempty" json:"forwarder,omitempty"` -} - -type ChainConfig struct { - Name string `json:"name"` - Selector *SelectorConfig `yaml:",omitempty" json:"selector,omitempty"` - Hops []*HopConfig `json:"hops"` -} - -type HopConfig struct { - Name string `json:"name"` - Interface string `yaml:",omitempty" json:"interface,omitempty"` - Selector *SelectorConfig `yaml:",omitempty" json:"selector,omitempty"` - Bypass string `yaml:",omitempty" json:"bypass,omitempty"` - Resolver string `yaml:",omitempty" json:"resolver,omitempty"` - Hosts string `yaml:",omitempty" json:"hosts,omitempty"` - Nodes []*NodeConfig `json:"nodes"` -} - -type NodeConfig struct { - Name string `json:"name"` - Addr string `yaml:",omitempty" json:"addr,omitempty"` - Interface string `yaml:",omitempty" json:"interface,omitempty"` - Bypass string `yaml:",omitempty" json:"bypass,omitempty"` - Resolver string `yaml:",omitempty" json:"resolver,omitempty"` - Hosts string `yaml:",omitempty" json:"hosts,omitempty"` - Connector *ConnectorConfig `yaml:",omitempty" json:"connector,omitempty"` - Dialer *DialerConfig `yaml:",omitempty" json:"dialer,omitempty"` -} - -type Config struct { - Services []*ServiceConfig `json:"services"` - Chains []*ChainConfig `yaml:",omitempty" json:"chains,omitempty"` - Authers []*AutherConfig `yaml:",omitempty" json:"authers,omitempty"` - Admissions []*AdmissionConfig `yaml:",omitempty" json:"admissions,omitempty"` - Bypasses []*BypassConfig `yaml:",omitempty" json:"bypasses,omitempty"` - Resolvers []*ResolverConfig `yaml:",omitempty" json:"resolvers,omitempty"` - Hosts []*HostsConfig `yaml:",omitempty" json:"hosts,omitempty"` - TLS *TLSConfig `yaml:",omitempty" json:"tls,omitempty"` - Log *LogConfig `yaml:",omitempty" json:"log,omitempty"` - Profiling *ProfilingConfig `yaml:",omitempty" json:"profiling,omitempty"` - API *APIConfig `yaml:",omitempty" json:"api,omitempty"` - Metrics *MetricsConfig `yaml:",omitempty" json:"metrics,omitempty"` -} - -func (c *Config) Load() error { - if err := v.ReadInConfig(); err != nil { - return err - } - - return v.Unmarshal(c) -} - -func (c *Config) Read(r io.Reader) error { - if err := v.ReadConfig(r); err != nil { - return err - } - - return v.Unmarshal(c) -} - -func (c *Config) ReadFile(file string) error { - v.SetConfigFile(file) - if err := v.ReadInConfig(); err != nil { - return err - } - return v.Unmarshal(c) -} - -func (c *Config) Write(w io.Writer, format string) error { - switch format { - case "json": - enc := json.NewEncoder(w) - enc.SetIndent("", " ") - enc.Encode(c) - return nil - case "yaml": - fallthrough - default: - enc := yaml.NewEncoder(w) - defer enc.Close() - - return enc.Encode(c) - } -} diff --git a/pkg/config/parsing/chain.go b/pkg/config/parsing/chain.go deleted file mode 100644 index 08cdd43..0000000 --- a/pkg/config/parsing/chain.go +++ /dev/null @@ -1,136 +0,0 @@ -package parsing - -import ( - "github.com/go-gost/gost/v3/pkg/chain" - tls_util "github.com/go-gost/gost/v3/pkg/common/util/tls" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/connector" - "github.com/go-gost/gost/v3/pkg/dialer" - "github.com/go-gost/gost/v3/pkg/logger" - "github.com/go-gost/gost/v3/pkg/metadata" - "github.com/go-gost/gost/v3/pkg/registry" -) - -func ParseChain(cfg *config.ChainConfig) (chain.Chainer, error) { - if cfg == nil { - return nil, nil - } - - chainLogger := logger.Default().WithFields(map[string]any{ - "kind": "chain", - "chain": cfg.Name, - }) - - c := &chain.Chain{} - selector := parseSelector(cfg.Selector) - for _, hop := range cfg.Hops { - group := &chain.NodeGroup{} - for _, v := range hop.Nodes { - nodeLogger := chainLogger.WithFields(map[string]any{ - "kind": "node", - "connector": v.Connector.Type, - "dialer": v.Dialer.Type, - "hop": hop.Name, - "node": v.Name, - }) - connectorLogger := nodeLogger.WithFields(map[string]any{ - "kind": "connector", - }) - - tlsCfg := v.Connector.TLS - if tlsCfg == nil { - tlsCfg = &config.TLSConfig{} - } - tlsConfig, err := tls_util.LoadClientConfig( - tlsCfg.CertFile, tlsCfg.KeyFile, tlsCfg.CAFile, - tlsCfg.Secure, tlsCfg.ServerName) - if err != nil { - chainLogger.Error(err) - return nil, err - } - - cr := registry.ConnectorRegistry().Get(v.Connector.Type)( - connector.AuthOption(parseAuth(v.Connector.Auth)), - connector.TLSConfigOption(tlsConfig), - connector.LoggerOption(connectorLogger), - ) - - if v.Connector.Metadata == nil { - v.Connector.Metadata = make(map[string]any) - } - if err := cr.Init(metadata.MapMetadata(v.Connector.Metadata)); err != nil { - connectorLogger.Error("init: ", err) - return nil, err - } - - dialerLogger := nodeLogger.WithFields(map[string]any{ - "kind": "dialer", - }) - - tlsCfg = v.Dialer.TLS - if tlsCfg == nil { - tlsCfg = &config.TLSConfig{} - } - tlsConfig, err = tls_util.LoadClientConfig( - tlsCfg.CertFile, tlsCfg.KeyFile, tlsCfg.CAFile, - tlsCfg.Secure, tlsCfg.ServerName) - if err != nil { - chainLogger.Error(err) - return nil, err - } - - d := registry.DialerRegistry().Get(v.Dialer.Type)( - dialer.AuthOption(parseAuth(v.Dialer.Auth)), - dialer.TLSConfigOption(tlsConfig), - dialer.LoggerOption(dialerLogger), - ) - - if v.Dialer.Metadata == nil { - v.Dialer.Metadata = make(map[string]any) - } - if err := d.Init(metadata.MapMetadata(v.Dialer.Metadata)); err != nil { - dialerLogger.Error("init: ", err) - return nil, err - } - - if v.Bypass == "" { - v.Bypass = hop.Bypass - } - if v.Resolver == "" { - v.Resolver = hop.Resolver - } - if v.Hosts == "" { - v.Hosts = hop.Hosts - } - if v.Interface == "" { - v.Interface = hop.Interface - } - - tr := (&chain.Transport{}). - WithConnector(cr). - WithDialer(d). - WithAddr(v.Addr). - WithInterface(v.Interface) - - node := &chain.Node{ - Name: v.Name, - Addr: v.Addr, - Bypass: registry.BypassRegistry().Get(v.Bypass), - Resolver: registry.ResolverRegistry().Get(v.Resolver), - Hosts: registry.HostsRegistry().Get(v.Hosts), - Marker: &chain.FailMarker{}, - Transport: tr, - } - group.AddNode(node) - } - - sel := selector - if s := parseSelector(hop.Selector); s != nil { - sel = s - } - group.WithSelector(sel) - c.AddNodeGroup(group) - } - - return c, nil -} diff --git a/pkg/config/parsing/parse.go b/pkg/config/parsing/parse.go deleted file mode 100644 index 3fadd69..0000000 --- a/pkg/config/parsing/parse.go +++ /dev/null @@ -1,161 +0,0 @@ -package parsing - -import ( - "net" - "net/url" - - "github.com/go-gost/gost/v3/pkg/admission" - "github.com/go-gost/gost/v3/pkg/auth" - "github.com/go-gost/gost/v3/pkg/bypass" - "github.com/go-gost/gost/v3/pkg/chain" - "github.com/go-gost/gost/v3/pkg/config" - hostspkg "github.com/go-gost/gost/v3/pkg/hosts" - "github.com/go-gost/gost/v3/pkg/logger" - "github.com/go-gost/gost/v3/pkg/registry" - "github.com/go-gost/gost/v3/pkg/resolver" - resolver_impl "github.com/go-gost/gost/v3/pkg/resolver/impl" -) - -func ParseAuther(cfg *config.AutherConfig) auth.Authenticator { - if cfg == nil { - return nil - } - - m := make(map[string]string) - - for _, user := range cfg.Auths { - if user.Username == "" { - continue - } - m[user.Username] = user.Password - } - - if len(m) == 0 { - return nil - } - return auth.NewAuthenticator(m) -} - -func ParseAutherFromAuth(au *config.AuthConfig) auth.Authenticator { - if au == nil || au.Username == "" { - return nil - } - return auth.NewAuthenticator(map[string]string{ - au.Username: au.Password, - }) -} - -func parseAuth(cfg *config.AuthConfig) *url.Userinfo { - if cfg == nil || cfg.Username == "" { - return nil - } - - if cfg.Password == "" { - return url.User(cfg.Username) - } - return url.UserPassword(cfg.Username, cfg.Password) -} - -func parseSelector(cfg *config.SelectorConfig) chain.Selector { - if cfg == nil { - return nil - } - - var strategy chain.Strategy - switch cfg.Strategy { - case "round", "rr": - strategy = chain.RoundRobinStrategy() - case "random", "rand": - strategy = chain.RandomStrategy() - case "fifo", "ha": - strategy = chain.FIFOStrategy() - default: - strategy = chain.RoundRobinStrategy() - } - - return chain.NewSelector( - strategy, - chain.InvalidFilter(), - chain.FailFilter(cfg.MaxFails, cfg.FailTimeout), - ) -} - -func ParseAdmission(cfg *config.AdmissionConfig) admission.Admission { - if cfg == nil { - return nil - } - return admission.NewAdmissionPatterns( - cfg.Reverse, - cfg.Matchers, - admission.LoggerOption(logger.Default().WithFields(map[string]any{ - "kind": "admission", - "admission": cfg.Name, - })), - ) -} - -func ParseBypass(cfg *config.BypassConfig) bypass.Bypass { - if cfg == nil { - return nil - } - return bypass.NewBypassPatterns( - cfg.Reverse, - cfg.Matchers, - bypass.LoggerOption(logger.Default().WithFields(map[string]any{ - "kind": "bypass", - "bypass": cfg.Name, - })), - ) -} - -func ParseResolver(cfg *config.ResolverConfig) (resolver.Resolver, error) { - if cfg == nil { - return nil, nil - } - var nameservers []resolver_impl.NameServer - for _, server := range cfg.Nameservers { - nameservers = append(nameservers, resolver_impl.NameServer{ - Addr: server.Addr, - Chain: registry.ChainRegistry().Get(server.Chain), - TTL: server.TTL, - Timeout: server.Timeout, - ClientIP: net.ParseIP(server.ClientIP), - Prefer: server.Prefer, - Hostname: server.Hostname, - }) - } - - return resolver_impl.NewResolver( - nameservers, - resolver_impl.LoggerResolverOption( - logger.Default().WithFields(map[string]any{ - "kind": "resolver", - "resolver": cfg.Name, - }), - ), - ) -} - -func ParseHosts(cfg *config.HostsConfig) hostspkg.HostMapper { - if cfg == nil || len(cfg.Mappings) == 0 { - return nil - } - hosts := hostspkg.NewHosts() - hosts.Logger = logger.Default().WithFields(map[string]any{ - "kind": "hosts", - "hosts": cfg.Name, - }) - - for _, host := range cfg.Mappings { - if host.IP == "" || host.Hostname == "" { - continue - } - - ip := net.ParseIP(host.IP) - if ip == nil { - continue - } - hosts.Map(ip, host.Hostname, host.Aliases...) - } - return hosts -} diff --git a/pkg/config/parsing/service.go b/pkg/config/parsing/service.go deleted file mode 100644 index 1e5dcab..0000000 --- a/pkg/config/parsing/service.go +++ /dev/null @@ -1,149 +0,0 @@ -package parsing - -import ( - "strings" - - "github.com/go-gost/gost/v3/pkg/chain" - tls_util "github.com/go-gost/gost/v3/pkg/common/util/tls" - "github.com/go-gost/gost/v3/pkg/config" - "github.com/go-gost/gost/v3/pkg/handler" - "github.com/go-gost/gost/v3/pkg/listener" - "github.com/go-gost/gost/v3/pkg/logger" - "github.com/go-gost/gost/v3/pkg/metadata" - "github.com/go-gost/gost/v3/pkg/registry" - "github.com/go-gost/gost/v3/pkg/service" -) - -func ParseService(cfg *config.ServiceConfig) (service.Service, error) { - if cfg.Listener == nil { - cfg.Listener = &config.ListenerConfig{ - Type: "tcp", - } - } - if cfg.Handler == nil { - cfg.Handler = &config.HandlerConfig{ - Type: "auto", - } - } - serviceLogger := logger.Default().WithFields(map[string]any{ - "kind": "service", - "service": cfg.Name, - "listener": cfg.Listener.Type, - "handler": cfg.Handler.Type, - }) - - listenerLogger := serviceLogger.WithFields(map[string]any{ - "kind": "listener", - }) - - tlsCfg := cfg.Listener.TLS - if tlsCfg == nil { - tlsCfg = &config.TLSConfig{} - } - tlsConfig, err := tls_util.LoadServerConfig( - tlsCfg.CertFile, tlsCfg.KeyFile, tlsCfg.CAFile) - if err != nil { - listenerLogger.Error(err) - return nil, err - } - - auther := ParseAutherFromAuth(cfg.Listener.Auth) - if cfg.Listener.Auther != "" { - auther = registry.AutherRegistry().Get(cfg.Listener.Auther) - } - - ln := registry.ListenerRegistry().Get(cfg.Listener.Type)( - listener.AddrOption(cfg.Addr), - listener.AutherOption(auther), - listener.AuthOption(parseAuth(cfg.Listener.Auth)), - listener.TLSConfigOption(tlsConfig), - listener.AdmissionOption(registry.AdmissionRegistry().Get(cfg.Admission)), - listener.ChainOption(registry.ChainRegistry().Get(cfg.Listener.Chain)), - listener.LoggerOption(listenerLogger), - listener.ServiceOption(cfg.Name), - ) - - if cfg.Listener.Metadata == nil { - cfg.Listener.Metadata = make(map[string]any) - } - if err := ln.Init(metadata.MapMetadata(cfg.Listener.Metadata)); err != nil { - listenerLogger.Error("init: ", err) - return nil, err - } - - handlerLogger := serviceLogger.WithFields(map[string]any{ - "kind": "handler", - }) - - tlsCfg = cfg.Handler.TLS - if tlsCfg == nil { - tlsCfg = &config.TLSConfig{} - } - tlsConfig, err = tls_util.LoadServerConfig( - tlsCfg.CertFile, tlsCfg.KeyFile, tlsCfg.CAFile) - if err != nil { - handlerLogger.Error(err) - return nil, err - } - - auther = ParseAutherFromAuth(cfg.Handler.Auth) - if cfg.Handler.Auther != "" { - auther = registry.AutherRegistry().Get(cfg.Handler.Auther) - } - - router := (&chain.Router{}). - WithRetries(cfg.Handler.Retries). - // WithTimeout(timeout time.Duration). - WithInterface(cfg.Interface). - WithChain(registry.ChainRegistry().Get(cfg.Handler.Chain)). - WithResolver(registry.ResolverRegistry().Get(cfg.Resolver)). - WithHosts(registry.HostsRegistry().Get(cfg.Hosts)). - WithLogger(handlerLogger) - - h := registry.HandlerRegistry().Get(cfg.Handler.Type)( - handler.RouterOption(router), - handler.AutherOption(auther), - handler.AuthOption(parseAuth(cfg.Handler.Auth)), - handler.BypassOption(registry.BypassRegistry().Get(cfg.Bypass)), - handler.TLSConfigOption(tlsConfig), - handler.LoggerOption(handlerLogger), - ) - - if forwarder, ok := h.(handler.Forwarder); ok { - forwarder.Forward(parseForwarder(cfg.Forwarder)) - } - - if cfg.Handler.Metadata == nil { - cfg.Handler.Metadata = make(map[string]any) - } - if err := h.Init(metadata.MapMetadata(cfg.Handler.Metadata)); err != nil { - handlerLogger.Error("init: ", err) - return nil, err - } - - s := service.NewService(cfg.Name, ln, h, - service.AdmissionOption(registry.AdmissionRegistry().Get(cfg.Admission)), - service.LoggerOption(serviceLogger), - ) - - serviceLogger.Infof("listening on %s/%s", s.Addr().String(), s.Addr().Network()) - return s, nil -} - -func parseForwarder(cfg *config.ForwarderConfig) *chain.NodeGroup { - if cfg == nil || len(cfg.Targets) == 0 { - return nil - } - - group := &chain.NodeGroup{} - for _, target := range cfg.Targets { - if v := strings.TrimSpace(target); v != "" { - group.AddNode(&chain.Node{ - Name: target, - Addr: target, - Marker: &chain.FailMarker{}, - }) - } - } - return group.WithSelector(parseSelector(cfg.Selector)) -} diff --git a/pkg/internal/util/http2/conn.go b/pkg/internal/util/http2/conn.go deleted file mode 100644 index eb2f43c..0000000 --- a/pkg/internal/util/http2/conn.go +++ /dev/null @@ -1,132 +0,0 @@ -package http2 - -import ( - "errors" - "net" - "net/http" - "time" -) - -// a dummy HTTP2 client conn used by HTTP2 client connector -type ClientConn struct { - localAddr net.Addr - remoteAddr net.Addr - client *http.Client - onClose func() -} - -func NewClientConn(localAddr, remoteAddr net.Addr, client *http.Client, onClose func()) net.Conn { - return &ClientConn{ - localAddr: localAddr, - remoteAddr: remoteAddr, - client: client, - onClose: onClose, - } -} - -func (c *ClientConn) Client() *http.Client { - return c.client -} - -func (c *ClientConn) Close() error { - if c.onClose != nil { - c.onClose() - } - return nil -} - -func (c *ClientConn) Read(b []byte) (n int, err error) { - return 0, &net.OpError{Op: "read", Net: "nop", Source: nil, Addr: nil, Err: errors.New("read not supported")} -} - -func (c *ClientConn) Write(b []byte) (n int, err error) { - return 0, &net.OpError{Op: "write", Net: "nop", Source: nil, Addr: nil, Err: errors.New("write not supported")} -} - -func (c *ClientConn) LocalAddr() net.Addr { - return c.localAddr -} - -func (c *ClientConn) RemoteAddr() net.Addr { - return c.remoteAddr -} - -func (c *ClientConn) SetDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "nop", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -} - -func (c *ClientConn) SetReadDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "nop", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -} - -func (c *ClientConn) SetWriteDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "nop", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -} - -// a dummy HTTP2 server conn used by HTTP2 handler -type ServerConn struct { - r *http.Request - w http.ResponseWriter - localAddr net.Addr - remoteAddr net.Addr - closed chan struct{} -} - -func NewServerConn(w http.ResponseWriter, r *http.Request, localAddr, remoteAddr net.Addr) *ServerConn { - return &ServerConn{ - r: r, - w: w, - localAddr: localAddr, - remoteAddr: remoteAddr, - closed: make(chan struct{}), - } -} - -func (c *ServerConn) Done() <-chan struct{} { - return c.closed -} - -func (c *ServerConn) Request() *http.Request { - return c.r -} - -func (c *ServerConn) Writer() http.ResponseWriter { - return c.w -} - -func (c *ServerConn) Read(b []byte) (n int, err error) { - return 0, &net.OpError{Op: "read", Net: "http2", Source: nil, Addr: nil, Err: errors.New("read not supported")} -} - -func (c *ServerConn) Write(b []byte) (n int, err error) { - return 0, &net.OpError{Op: "write", Net: "http2", Source: nil, Addr: nil, Err: errors.New("write not supported")} -} - -func (c *ServerConn) Close() error { - select { - case <-c.closed: - default: - close(c.closed) - } - return nil -} - -func (c *ServerConn) LocalAddr() net.Addr { - return c.localAddr -} - -func (c *ServerConn) RemoteAddr() net.Addr { - return c.remoteAddr -} - -func (c *ServerConn) SetDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "http2", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -} - -func (c *ServerConn) SetReadDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "http2", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -} - -func (c *ServerConn) SetWriteDeadline(t time.Time) error { - return &net.OpError{Op: "set", Net: "http2", Source: nil, Addr: nil, Err: errors.New("deadline not supported")} -}