diff --git a/after_script.sh b/after_script.sh deleted file mode 100644 index fbe490d..0000000 --- a/after_script.sh +++ /dev/null @@ -1,6 +0,0 @@ -iptables -t mangle -D PREROUTING -p tcp -m set --match-set GTUN-US dst -j TPROXY --tproxy-mark 1/1 --on-port 8524 -iptables -t mangle -D PREROUTING -p udp -m set --match-set GTUN-US dst -j TPROXY --tproxy-mark 1/1 --on-port 8524 -iptables -t mangle -D OUTPUT -m set --match-set GTUN-US dst -j MARK --set-mark 1 -ip rule del fwmark 1 lookup 100 -ip ro del local default dev lo table 100 -ipset destroy GTUN-US \ No newline at end of file diff --git a/before_script.sh b/before_script.sh deleted file mode 100644 index e5b4463..0000000 --- a/before_script.sh +++ /dev/null @@ -1,6 +0,0 @@ -ipset create GTUN-US hash:net -iptables -t mangle -I PREROUTING -p tcp -m set --match-set GTUN-US dst -j TPROXY --tproxy-mark 1/1 --on-port 8524 -iptables -t mangle -I PREROUTING -p udp -m set --match-set GTUN-US dst -j TPROXY --tproxy-mark 1/1 --on-port 8524 -iptables -t mangle -I OUTPUT -m set --match-set GTUN-US dst -j MARK --set-mark 1 -ip rule add fwmark 1 lookup 100 -ip ro add local default dev lo table 100 \ No newline at end of file diff --git a/build_exec.sh b/build_exec.sh index 675471d..a725b6b 100755 --- a/build_exec.sh +++ b/build_exec.sh @@ -9,5 +9,6 @@ GOOS=linux go build -o bin/gtun/gtun-linux_amd64 cmd/gtun/*.go GOARCH=arm GOOS=linux go build -o bin/gtun/gtun-linux_arm cmd/gtun/*.go echo "builded gtun...." -cp before_script.sh bin/ -cp after_script.sh bin/ \ No newline at end of file +cp -r etc/gtun.yaml bin/gtun/ +cp -r etc/gtund.yaml bin/gtund/ +cp install.sh bin/gtun/ \ No newline at end of file diff --git a/build_image.sh b/build_image.sh index 5dc92e8..a3a198d 100755 --- a/build_image.sh +++ b/build_image.sh @@ -7,9 +7,8 @@ cp $WORKSPACE/bin/gtund/gtund . docker build . -t gtund echo "builded gtund docker image" - echo "building gtun docker image" cd $WORKSPACE/docker-build/gtun cp $WORKSPACE/bin/gtun/gtun-linux_amd64 . docker build . -t gtun -echo "builded gtun docker image" +echo "builded gtun docker image" \ No newline at end of file diff --git a/docker-build/docker-compose.yaml b/docker-build/docker-compose.yaml new file mode 100644 index 0000000..9e5d282 --- /dev/null +++ b/docker-build/docker-compose.yaml @@ -0,0 +1,65 @@ +version: '3' +services: + gtun: + build: ./gtun + container_name: gtun + restart: always + network_mode: host + privileged: true + volumes: + - /opt/apps/logs:/opt/logs + environment: + TIME_ZONE: Asia/Shanghai + settings: | + settings: + CN: + proxy_file: "https://www.ipdeny.com/ipblocks/data/countries/us.zone" + route: + - trace_addr: ${CN_SERVER_IP}:${CN_SERVER_TRACE_PORT} + scheme: "kcp" + addr: ${CN_SERVER_IP}:${CN_SERVER_PORT} + auth_key: "" + proxy: + "tproxy_tcp": | + { + "read_timeout": 30, + "write_timeout": 30, + "listen_addr": ":8524", + "rate_limit": 50, + "region": "CN" + } + "tproxy_udp": | + { + "read_timeout": 30, + "write_timeout": 30, + "session_timeout": 30, + "listen_addr": ":8524", + "rate_limit": 50, + "region": "CN" + } + log: + days: 5 + level: Debug + path: gtun.log + + http_server: + listen_addr: ":9001" + gtund: + build: ./gtund + container_name: gtund + restart: always + network_mode: host + volumes: + - /opt/apps/logs:/logs + environment: + TIME_ZONE: Asia/Shanghai + settings: | + server: + - listen: ":3002" + authKey: "rewrite with your auth key" + scheme: "kcp" + trace: ":3003" + log: + days: 5 + level: "debug" + path: "gtund.log" diff --git a/docker-build/gtun/Dockerfile b/docker-build/gtun/Dockerfile index be8d6f0..921194b 100644 --- a/docker-build/gtun/Dockerfile +++ b/docker-build/gtun/Dockerfile @@ -3,4 +3,4 @@ COPY gtun-linux_amd64 /gtun COPY start.sh / RUN chmod +x start.sh && chmod +x gtun RUN mkdir /opt/logs -CMD /start.sh +CMD /start.sh \ No newline at end of file diff --git a/docker-build/gtun/docker-compose.yaml b/docker-build/gtun/docker-compose.yaml deleted file mode 100644 index 03fb6c0..0000000 --- a/docker-build/gtun/docker-compose.yaml +++ /dev/null @@ -1,29 +0,0 @@ -version: '3' -services: - gtun: - build: . - container_name: gtun - restart: always - network_mode: host - privileged: true - volumes: - - /opt/apps/logs:/opt/logs - environment: - TIME_ZONE: Asia/Shanghai - settings: | - forwards: - - region: US - tcp: - listen: ":2012" - udp: - listen: ":2012" - transport: - - server: "ip:port" - scheme: kcp - traceAddr: "" - rateLimit: 1000 - - log: - days: 5 - level: "info" - path: "gtun.log" \ No newline at end of file diff --git a/docker-build/gtun/start.sh b/docker-build/gtun/start.sh index 083b22c..dc0f65c 100644 --- a/docker-build/gtun/start.sh +++ b/docker-build/gtun/start.sh @@ -8,4 +8,4 @@ if [ "$settings" != "" ]; then echo "$settings" > /gtun.yaml fi -/gtun -c /gtun.yaml +/gtun -c /gtun.yaml \ No newline at end of file diff --git a/docker-build/gtund/docker-compose.yaml b/docker-build/gtund/docker-compose.yaml deleted file mode 100644 index 033e5a8..0000000 --- a/docker-build/gtund/docker-compose.yaml +++ /dev/null @@ -1,22 +0,0 @@ -version: '3' -services: - gtund: - build: . - container_name: gtund - restart: always - network_mode: host - volumes: - - /opt/apps/logs:/logs - environment: - TIME_ZONE: Asia/Shanghai - settings: | - server: - - listen: ":3002" - authKey: "rewrite with your auth key" - scheme: "kcp" - trace: ":3003" - - log: - days: 5 - level: "debug" - path: "gtund.log" diff --git a/docker-build/gtund/start.sh b/docker-build/gtund/start.sh index 10e6114..813e79f 100644 --- a/docker-build/gtund/start.sh +++ b/docker-build/gtund/start.sh @@ -8,4 +8,4 @@ if [ "$settings" != "" ]; then echo "$settings" > /gtund.yaml fi -/gtund -c /gtund.yaml +/gtund -c /gtund.yaml \ No newline at end of file diff --git a/etc/gtun.yaml b/etc/gtun.yaml index 7a3c44d..f05f840 100644 --- a/etc/gtun.yaml +++ b/etc/gtun.yaml @@ -1,21 +1,33 @@ -forwards: - - region: US - tcp: - listen: ":2012" - udp: - listen: ":2012" - transport: - - server: "ip:port" - authKey: "rewrite with your auth key" - scheme: kcp - traceAddr: "" - - server: "ip:port" - auth_key: "rewrite with your auth key" - scheme: mux - traceAddr: "" - rateLimit: 1000 - +settings: + CN: + proxy_file: "https://www.ipdeny.com/ipblocks/data/countries/us.zone" + route: + - trace_addr: ${CN_SERVER_IP}:${CN_SERVER_TRACE_PORT} + scheme: "kcp" + addr: ${CN_SERVER_IP}:${CN_SERVER_PORT} + auth_key: "" + proxy: + "tproxy_tcp": | + { + "read_timeout": 30, + "write_timeout": 30, + "listen_addr": ":8524", + "rate_limit": 50, + "region": "CN" + } + "tproxy_udp": | + { + "read_timeout": 30, + "write_timeout": 30, + "session_timeout": 30, + "listen_addr": ":8524", + "rate_limit": 50, + "region": "CN" + } log: days: 5 - level: "info" - path: "gtun.log" \ No newline at end of file + level: Debug + path: gtun.log + +http_server: + listen_addr: ":9001"" \ No newline at end of file diff --git a/go.mod b/go.mod index c7eabe0..2b2d345 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,12 @@ go 1.16 require ( github.com/ICKelin/optw v0.0.0-20211219021958-28f4d1f075ef + github.com/agiledragon/gomonkey/v2 v2.10.1 github.com/astaxie/beego v1.12.3 github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 - github.com/gogo/protobuf v1.3.1 + github.com/gogo/protobuf v1.3.2 + github.com/smartystreets/goconvey v1.8.1 + github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index a63d68c..ac4cc44 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,60 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +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.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= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +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/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= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +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.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +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= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +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= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ICKelin/gtun v1.0.5-0.20211204061645-ed01445bf708/go.mod h1:lXqvFm0rxLK0HAWUJYEbrkfStUJsamURyjoIelB5FHE= github.com/ICKelin/optw v0.0.0-20211219021958-28f4d1f075ef h1:f2j59p1x1OG/73AaAYy3nxMCfaGilxTQdOqkueaF4FQ= github.com/ICKelin/optw v0.0.0-20211219021958-28f4d1f075ef/go.mod h1:G3/YSddzYP9BhFIiEeXR3H5Q5s4ykReqromA4w47fH8= github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= +github.com/agiledragon/gomonkey/v2 v2.10.1 h1:FPJJNykD1957cZlGhr9X0zjr291/lbazoZ/dmc4mS4c= +github.com/agiledragon/gomonkey/v2 v2.10.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= +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/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= @@ -18,22 +64,48 @@ github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff/go.mod h1:PhH1ZhyCzHK 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/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg= github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +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/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/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= +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-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -41,37 +113,122 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +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.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +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= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +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/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= 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/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +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/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +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/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= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +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/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 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/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= +github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +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-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-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +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/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +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/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +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.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= 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= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +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 h1:EBfaK0SWSwk+fgk6efYFWdzl8MwRWoOO1gkmiaTXPW4= github.com/klauspost/cpuid v1.2.4/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/reedsolomon v1.9.9 h1:qCL7LZlv17xMixl55nq2/Oa1Y86nfO8EqDfv2GHND54= github.com/klauspost/reedsolomon v1.9.9/go.mod h1:O7yFFHiQwDR6b2t63KPUpccPtNdp5ADgh1gg4fd12wo= github.com/konsorten/go-windows-terminal-sequences v1.0.1/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/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -79,8 +236,20 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.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/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +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.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mmcloughlin/avo v0.0.0-20201216231306-039ef47f4f69 h1:U3a/eCFK1x5LmMPHYND8zfvAa1NS8pVK60UblgsTwmA= github.com/mmcloughlin/avo v0.0.0-20201216231306-039ef47f4f69/go.mod h1:6aKT4zZIrpGqB3RpFU14ByCSSyKY6LfJz4J/JJChHfI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -88,43 +257,78 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= 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/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/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= github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= +github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= +github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY= +github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60= +github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 h1:TG/diQgUe0pntT/2D9tmUCz4VNwm9MfrtPr0SU2qSX8= +github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E= +github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= 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= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU= @@ -141,73 +345,414 @@ github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 h1:EWU6Pktpas0n8lL github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37/go.mod h1:HpMP7DB2CyokmAh4lp0EQnnWhmycP/TvwBGzvuie+H0= github.com/xtaci/smux v1.5.15 h1:6hMiXswcleXj5oNfcJc+DXS8Vj36XX2LaX98udog6Kc= github.com/xtaci/smux v1.5.15/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +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= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= +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.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +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.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= golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= 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-20190308221718-c2843e01d9a2/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +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= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs= +golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +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-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +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-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-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +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-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= 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= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/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-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-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/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-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= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/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= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/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-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-20210510120138-977fb7262007/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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201105001634-bc3cf281b174 h1:0rx0F4EjJNbxTuzWe0KjKcIzs+3VEb/Mrs/d1ciNz1c= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +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-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201105001634-bc3cf281b174/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/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.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +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.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +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-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +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.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= 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= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= 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= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 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/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/gtun/client.go b/gtun/client.go deleted file mode 100644 index 680eb83..0000000 --- a/gtun/client.go +++ /dev/null @@ -1,50 +0,0 @@ -package gtun - -import ( - "time" - - "github.com/ICKelin/gtun/internal/logs" - "github.com/ICKelin/optw/transport" -) - -type ClientConfig struct { - Region string - ServerAddr string - AuthKey string -} - -type Client struct { - dialer transport.Dialer - sessionMgr *SessionManager -} - -func NewClient(dialer transport.Dialer) *Client { - return &Client{ - dialer: dialer, - sessionMgr: GetSessionManager(), - } -} - -func (c *Client) Run(region string) { - for { - conn, err := c.dialer.Dial() - if err != nil { - logs.Error("connect to %s fail: %v", region, err) - time.Sleep(time.Second * 3) - continue - } - - logs.Info("connect to region %s success", region) - sess := newSession(conn, region) - c.sessionMgr.AddSession(region, sess) - tick := time.NewTicker(time.Second * 1) - for range tick.C { - if sess.conn.IsClosed() { - break - } - } - - c.sessionMgr.DeleteSession(region, sess) - logs.Warn("reconnect") - } -} diff --git a/gtun/config.go b/gtun/config.go index d9b6d99..8f30386 100644 --- a/gtun/config.go +++ b/gtun/config.go @@ -1,43 +1,34 @@ package gtun import ( - "io/ioutil" - "gopkg.in/yaml.v2" + "os" ) -type Config struct { - Forwards []ForwardConfig `yaml:"forwards"` - Log Log `yaml:"log"` -} +var gConfig *Config -type ForwardConfig struct { - Region string `yaml:"region"` - TCPForward TCPForwardConfig `yaml:"tcp"` - UDPForward UDPForwardConfig `yaml:"udp"` - Transport []TransportConfig `yaml:"transport"` - Ratelimit uint64 `yaml:"rateLimit"` // rate limit mbps +type Config struct { + Settings map[string]RegionConfig `yaml:"settings"` + HTTPServer HTTPConfig `json:"http_server"` + Log Log `yaml:"log"` } -type TCPForwardConfig struct { - ListenAddr string `yaml:"listen"` - ReadTimeout int `yaml:"readTimeout"` - WriteTimeout int `yaml:"writeTimeout"` +type HTTPConfig struct { + ListenAddr string `json:"listen_addr"` } -type UDPForwardConfig struct { - ListenAddr string `yaml:"listen"` - ReadTimeout int `yaml:"readTimeout"` - WriteTimeout int `yaml:"writeTimeout"` - SessionTimeout int `yaml:"sessionTimeout"` +type RegionConfig struct { + Route []RouteConfig `yaml:"route"` + ProxyFile string `yaml:"proxy_file"` + Proxy map[string]string `yaml:"proxy"` } -type TransportConfig struct { - Server string `yaml:"server"` - AuthKey string `yaml:"authKey"` - Scheme string `yaml:"scheme"` - TraceAddr string `yaml:"traceAddr"` - ConfigContent string `yaml:"config"` +type RouteConfig struct { + Region string `yaml:"region"` + TraceAddr string `yaml:"trace_addr"` + Scheme string `yaml:"scheme"` + Addr string `yaml:"addr"` + AuthKey string `yaml:"auth_key"` } type Log struct { @@ -47,16 +38,24 @@ type Log struct { } func ParseConfig(path string) (*Config, error) { - content, err := ioutil.ReadFile(path) + content, err := os.ReadFile(path) if err != nil { return nil, err } - return parseConfig(content) + return ParseBuffer(content) } -func parseConfig(content []byte) (*Config, error) { +func ParseBuffer(content []byte) (*Config, error) { conf := Config{} err := yaml.Unmarshal(content, &conf) + if err != nil { + return nil, err + } + gConfig = &conf return &conf, err } + +func GetConfig() *Config { + return gConfig +} diff --git a/gtun/httpserver.go b/gtun/httpserver.go new file mode 100644 index 0000000..6c2f9d5 --- /dev/null +++ b/gtun/httpserver.go @@ -0,0 +1,115 @@ +package gtun + +import ( + "encoding/json" + "github.com/ICKelin/gtun/gtun/proxy" + "io" + "net/http" +) + +type HTTPServer struct { + listenAddr string +} + +func NewHTTPServer(listenAddr string) *HTTPServer { + return &HTTPServer{listenAddr: listenAddr} +} + +func (s *HTTPServer) ListenAndServe() error { + http.HandleFunc("/meta", loadMeta) + http.HandleFunc("/ip/add", addIP) + http.HandleFunc("/ip/delete", delIP) + return http.ListenAndServe(s.listenAddr, nil) +} + +type response struct { + Code int `json:"code"` + Message string `json:"message"` + Data interface{} `json:"data"` +} + +func loadMeta(w http.ResponseWriter, r *http.Request) { + regionList := make([]string, 0) + regions := GetConfig().Settings + for region, _ := range regions { + regionList = append(regionList, region) + } + + type replyBody struct { + Regions []string `json:"regions"` + Cfg *Config + } + + body := &replyBody{ + Regions: regionList, + Cfg: GetConfig(), + } + reply(w, body) +} + +func addIP(w http.ResponseWriter, r *http.Request) { + type req struct { + Region string `json:"region"` + IP string `json:"ip"` + } + + var form = req{} + err := bindForm(r, &form) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + return + } + + // add to ipset + err = proxy.AddIP(form.Region, form.IP) + if err != nil { + reply(w, &response{ + Code: -1, + Message: err.Error(), + Data: nil, + }) + return + } + + reply(w, &response{Code: 0, Message: "success"}) +} + +func delIP(w http.ResponseWriter, r *http.Request) { + type req struct { + Region string `json:"region"` + IP string `json:"ip"` + } + + var form = req{} + err := bindForm(r, &form) + if err != nil { + w.WriteHeader(http.StatusBadRequest) + return + } + + // delete from ipset + err = proxy.DelIP(form.Region, form.IP) + if err != nil { + reply(w, &response{ + Code: -1, + Message: err.Error(), + Data: nil, + }) + return + } + + reply(w, &response{Code: 0, Message: "success"}) +} + +func bindForm(r *http.Request, obj interface{}) error { + cnt, err := io.ReadAll(r.Body) + if err != nil { + return err + } + return json.Unmarshal(cnt, obj) +} + +func reply(w http.ResponseWriter, obj interface{}) { + buf, _ := json.Marshal(obj) + _, _ = w.Write(buf) +} diff --git a/gtun/main.go b/gtun/main.go index 60fae63..c634c7c 100644 --- a/gtun/main.go +++ b/gtun/main.go @@ -3,17 +3,11 @@ package gtun import ( "flag" "fmt" - "net/http" - - "github.com/ICKelin/optw/transport/transport_api" - + "github.com/ICKelin/gtun/gtun/proxy" + "github.com/ICKelin/gtun/gtun/route" "github.com/ICKelin/gtun/internal/logs" ) -func init() { - go http.ListenAndServe(":6060", nil) -} - func Main() { flgConf := flag.String("c", "", "config file") flag.Parse() @@ -25,52 +19,34 @@ func Main() { } logs.Init(conf.Log.Path, conf.Log.Level, conf.Log.Days) - raceManager := NewRaceManager() - raceTargets := make(map[string][]string) - for _, cfg := range conf.Forwards { - ratelimit := NewRateLimit() - ratelimit.SetRateLimit(int64(cfg.Ratelimit * 1024 * 1024)) - - tcpfw := NewTCPForward(cfg.Region, cfg.TCPForward, ratelimit) - lis, err := tcpfw.Listen() + // run proxy + for region, cfg := range conf.Settings { + // init plugins + err = proxy.Setup(region, cfg.ProxyFile, cfg.Proxy) if err != nil { - logs.Error("listen tproxy tcp fail: %v", err) + fmt.Printf("set proxy fail: %v\n", err) return } + } - go tcpfw.Serve(lis) - - udpfw := NewUDPForward(cfg.Region, cfg.UDPForward, ratelimit) - udpConn, err := udpfw.Listen() - if err != nil { - logs.Error("listen tproxy udp fail: %v", err) - return - } - - go udpfw.Serve(udpConn) - - for _, hopCfg := range cfg.Transport { - dialer, err := transport_api.NewDialer(hopCfg.Scheme, hopCfg.Server, hopCfg.ConfigContent) + // run route and race + raceManager := route.GetTraceManager() + for region, cfg := range conf.Settings { + raceTargets := make([]string, 0) + for _, r := range cfg.Route { + raceTargets = append(raceTargets, r.TraceAddr) + hopConn, err := route.CreateConnection(region, r.Scheme, r.Addr, r.AuthKey) if err != nil { - logs.Error("new dialer fail: %v", err) - continue - } - - client := NewClient(dialer) - go client.Run(cfg.Region) - - if hopCfg.TraceAddr != "" { - raceTargets[cfg.Region] = append(raceTargets[cfg.Region], hopCfg.TraceAddr) + fmt.Printf("connect to %s://%s fail: %v\n", r.Scheme, r.Addr, err) + return } + go hopConn.ConnectNextHop() } - } - for region, targets := range raceTargets { - race := NewRace(targets) - raceManager.AddRegionRace(region, race) + regionRace := route.NewTrace(region, raceTargets) + raceManager.AddRegionTrace(region, regionRace) } + raceManager.RunRace() - GetSessionManager().SetRaceManager(raceManager) - - select {} + panic(NewHTTPServer(conf.HTTPServer.ListenAddr).ListenAndServe()) } diff --git a/gtun/plugins.go b/gtun/plugins.go new file mode 100644 index 0000000..b895702 --- /dev/null +++ b/gtun/plugins.go @@ -0,0 +1,5 @@ +package gtun + +import ( + _ "github.com/ICKelin/gtun/gtun/proxy" +) diff --git a/gtun/proxy/redirect.go b/gtun/proxy/redirect.go new file mode 100644 index 0000000..de6974f --- /dev/null +++ b/gtun/proxy/redirect.go @@ -0,0 +1,83 @@ +package proxy + +import ( + "fmt" + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/gtun/internal/utils" + "strings" + "sync/atomic" +) + +var ( + markID = int32(1) + routeTableID = int32(101) +) + +func allocateMarkID() int32 { + return atomic.AddInt32(&markID, 1) +} + +func allocateRouteTableID() int32 { + return atomic.AddInt32(&routeTableID, 1) +} + +func initRedirect(proto, region, redirectPort string) { + setName := ipsetNamePrefix + region + + out, err := utils.ExecCmd("ipset", []string{"create", setName, "hash:net"}) + if err != nil { + logs.Warn("create ipset fail: %v %s", err, out) + } + + out, err = utils.ExecCmd("ipset", []string{"-F", setName}) + if err != nil { + logs.Warn("flush ipset fail: %v %s", err, out) + } + + markID := allocateMarkID() + routeTable := allocateRouteTableID() + + args := fmt.Sprintf("-t mangle -D PREROUTING -p %s -m set --match-set %s dst -j TPROXY --tproxy-mark %d/%d --on-port %s", proto, setName, markID, markID, redirectPort) + out, err = utils.ExecCmd("iptables", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + args = fmt.Sprintf("-t mangle -A PREROUTING -p %s -m set --match-set %s dst -j TPROXY --tproxy-mark %d/%d --on-port %s", proto, setName, markID, markID, redirectPort) + out, err = utils.ExecCmd("iptables", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + + args = fmt.Sprintf("-t mangle -D OUTPUT -p %s -m set --match-set %s dst -j MARK --set-mark %d", proto, setName, markID) + out, err = utils.ExecCmd("iptables", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + args = fmt.Sprintf("-t mangle -A OUTPUT -p %s -m set --match-set %s dst -j MARK --set-mark %d", proto, setName, markID) + out, err = utils.ExecCmd("iptables", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + + args = fmt.Sprintf("rule del fwmark %d lookup %d", markID, routeTable) + out, err = utils.ExecCmd("ip", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + args = fmt.Sprintf("rule add fwmark %d lookup %d", markID, routeTable) + out, err = utils.ExecCmd("ip", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + + args = fmt.Sprintf("ro del local default dev lo table %d", routeTable) + out, err = utils.ExecCmd("ip", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } + args = fmt.Sprintf("ro add local default dev lo table %d", routeTable) + out, err = utils.ExecCmd("ip", strings.Split(args, " ")) + if err != nil { + logs.Warn("%s %s %s", args, err, out) + } +} diff --git a/gtun/proxy/tpoxy_tcp.go b/gtun/proxy/tpoxy_tcp.go new file mode 100644 index 0000000..69c395e --- /dev/null +++ b/gtun/proxy/tpoxy_tcp.go @@ -0,0 +1,192 @@ +package proxy + +import ( + "encoding/json" + "fmt" + "github.com/ICKelin/gtun/gtun/route" + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/gtun/internal/proto" + "github.com/ICKelin/gtun/internal/utils" + "io" + "net" + "strings" + "sync" + "syscall" + "time" +) + +func init() { + _ = Register("tproxy_tcp", NewTProxyTCP) +} + +var ( + // default tcp timeout(read, write), 10 seconds + defaultTCPTimeout = 10 +) + +type TProxyTCPConfig struct { + ReadTimeout int `json:"read_timeout"` + WriteTimeout int `json:"write_timeout"` + ListenAddr string `json:"listen_addr"` + RateLimit int `json:"rate_limit"` + Region string `json:"region"` +} + +type TProxyTCP struct { + region string + listenAddr string + + // writeTimeout defines the tcp connection write timeout in second + // default value set to 10 seconds + writeTimeout time.Duration + + // readTimeout defines the tcp connection write timeout in second + // default value set to 10 seconds + readTimeout time.Duration + + mempool sync.Pool + + ratelimit *utils.RateLimit + + routeManager *route.Manager +} + +func NewTProxyTCP() Proxy { + return &TProxyTCP{} +} + +func (p *TProxyTCP) Name() string { + return "tproxy_tcp" +} + +func (p *TProxyTCP) Setup(cfgContent json.RawMessage) error { + var cfg = TProxyTCPConfig{} + err := json.Unmarshal(cfgContent, &cfg) + if err != nil { + return nil + } + + err = p.initConfig(cfg) + if err != nil { + return err + } + + return p.initRedirect() +} + +func (p *TProxyTCP) initConfig(cfg TProxyTCPConfig) error { + tcpReadTimeout := cfg.ReadTimeout + if tcpReadTimeout <= 0 { + tcpReadTimeout = defaultTCPTimeout + } + + tcpWriteTimeout := cfg.WriteTimeout + if tcpWriteTimeout <= 0 { + tcpWriteTimeout = defaultTCPTimeout + } + + rateLimit := utils.NewRateLimit() + rateLimit.SetRateLimit(int64(cfg.RateLimit * 1024 * 1024)) + + p.region = cfg.Region + p.listenAddr = cfg.ListenAddr + p.writeTimeout = time.Duration(tcpWriteTimeout) * time.Second + p.readTimeout = time.Duration(tcpReadTimeout) * time.Second + p.mempool = sync.Pool{ + New: func() interface{} { + return make([]byte, 32*1024) + }, + } + p.ratelimit = rateLimit + p.routeManager = route.GetRouteManager() + return nil +} + +func (p *TProxyTCP) initRedirect() error { + ipPort := strings.Split(p.listenAddr, ":") + if len(ipPort) != 2 { + return fmt.Errorf("invalid listen addr") + } + + initRedirect("tcp", p.region, ipPort[1]) + return nil +} + +func (p *TProxyTCP) ListenAndServe() error { + listener, err := net.Listen("tcp", p.listenAddr) + if err != nil { + return err + } + + // set socket with ip transparent option + file, err := listener.(*net.TCPListener).File() + if err != nil { + return err + } + defer file.Close() + + err = syscall.SetsockoptInt(int(file.Fd()), syscall.SOL_IP, syscall.IP_TRANSPARENT, 1) + if err != nil { + return err + } + + for { + conn, err := listener.Accept() + if err != nil { + logs.Error("accept fail: %v", err) + break + } + + go p.doProxy(conn) + } + + return nil +} + +func (p *TProxyTCP) doProxy(conn net.Conn) { + defer conn.Close() + + dip, dport, _ := net.SplitHostPort(conn.LocalAddr().String()) + sip, sport, _ := net.SplitHostPort(conn.RemoteAddr().String()) + + sess := p.routeManager.Route(p.region, dip) + if sess == nil { + logs.Error("no route to host: %s", dip) + return + } + logs.Debug("%s:%s=>%s:%s", sip, sport, dip, dport) + stream, err := sess.OpenStream() + if err != nil { + logs.Error("open stream fail: %v", err) + return + } + defer stream.Close() + + bytes := proto.EncodeProxyProtocol("tcp", sip, sport, dip, dport) + _ = stream.SetWriteDeadline(time.Now().Add(p.writeTimeout)) + _, err = stream.Write(bytes) + _ = stream.SetWriteDeadline(time.Time{}) + if err != nil { + logs.Error("stream write fail: %v", err) + return + } + + wg := &sync.WaitGroup{} + wg.Add(1) + defer wg.Wait() + + go func() { + defer wg.Done() + defer stream.Close() + defer conn.Close() + obj := p.mempool.Get() + defer p.mempool.Put(obj) + buf := obj.([]byte) + io.CopyBuffer(stream, conn, buf) + }() + + obj := p.mempool.Get() + defer p.mempool.Put(obj) + buf := obj.([]byte) + io.CopyBuffer(conn, stream, buf) +} diff --git a/gtun/proxy/tproxy_tcp_test.go b/gtun/proxy/tproxy_tcp_test.go new file mode 100644 index 0000000..9447172 --- /dev/null +++ b/gtun/proxy/tproxy_tcp_test.go @@ -0,0 +1,61 @@ +package proxy + +import ( + "bytes" + "net" + "testing" + "time" +) + +type dummyConn struct { + readBuf bytes.Buffer + writeBuf bytes.Buffer +} + +func (d *dummyConn) Read(b []byte) (n int, err error) { + n = copy(b, d.readBuf.Bytes()) + return n, nil +} + +func (d *dummyConn) Write(b []byte) (n int, err error) { + return d.writeBuf.Write(b) +} + +func (d *dummyConn) Close() error { + d.readBuf.Reset() + d.writeBuf.Reset() + return nil +} + +func (d *dummyConn) LocalAddr() net.Addr { + return nil +} + +func (d *dummyConn) RemoteAddr() net.Addr { + return nil +} + +func (d *dummyConn) SetDeadline(t time.Time) error { + return nil +} + +func (d *dummyConn) SetReadDeadline(t time.Time) error { + return nil +} + +func (d *dummyConn) SetWriteDeadline(t time.Time) error { + return nil +} + +func TestTProxyTCPDoProxy(t *testing.T) { + p := NewTProxyTCP() + cfg := `{}` + err := p.Setup([]byte(cfg)) + if err != nil { + t.Error(err) + return + } + + conn := &dummyConn{} + p.(*TProxyTCP).doProxy(conn) +} diff --git a/gtun/udpforward.go b/gtun/proxy/tproxy_udp.go similarity index 60% rename from gtun/udpforward.go rename to gtun/proxy/tproxy_udp.go index 41697be..b619e85 100644 --- a/gtun/udpforward.go +++ b/gtun/proxy/tproxy_udp.go @@ -1,21 +1,28 @@ -package gtun +package proxy import ( "bytes" "encoding/binary" + "encoding/json" "fmt" + "github.com/ICKelin/gtun/gtun/route" + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/gtun/internal/proto" + "github.com/ICKelin/gtun/internal/utils" + "github.com/ICKelin/optw/transport" "io" "net" + "strings" "sync" "syscall" "time" "unsafe" - - "github.com/ICKelin/gtun/internal/logs" - "github.com/ICKelin/gtun/internal/proto" - "github.com/ICKelin/optw/transport" ) +func init() { + _ = Register("tproxy_udp", NewTProxyUDP) +} + var ( // default udp timeout(read, write)(seconds) defaultUDPTimeout = 10 @@ -29,27 +36,57 @@ type udpSession struct { lastActive time.Time } -type UDPForward struct { +type TProxyUDPConfig struct { + ReadTimeout int `json:"read_timeout"` + WriteTimeout int `json:"write_timeout"` + SessionTimeout int `json:"session_timeout"` + ListenAddr string `json:"listen_addr"` + RateLimit int `json:"rate_limit"` + Region string `json:"region"` +} + +type TProxyUDP struct { region string listenAddr string - sessionTimeout int + sessionTimeout time.Duration readTimeout time.Duration writeTimeout time.Duration rawfd int - // the session manager is the global session manager - // it stores opennotr_client to opennotr_server connection - sessMgr *SessionManager + routeManager *route.Manager // udpSessions stores each client forward stream // the purpose of udpSession is to reuse stream udpSessions map[string]*udpSession udpsessLock sync.Mutex - ratelimit *RateLimit + ratelimit *utils.RateLimit } -func NewUDPForward(region string, cfg UDPForwardConfig, ratelimit *RateLimit) *UDPForward { +func NewTProxyUDP() Proxy { + return &TProxyUDP{} +} + +func (p *TProxyUDP) Name() string { + return "tproxy_udp" +} + +func (p *TProxyUDP) Setup(cfgContent json.RawMessage) error { + var cfg = TProxyUDPConfig{} + err := json.Unmarshal(cfgContent, &cfg) + if err != nil { + return nil + } + + err = p.initConfig(cfg) + if err != nil { + return err + } + + return p.initRedirect() +} + +func (p *TProxyUDP) initConfig(cfg TProxyUDPConfig) error { readTimeout := cfg.ReadTimeout if readTimeout <= 0 { readTimeout = defaultUDPTimeout @@ -65,72 +102,82 @@ func NewUDPForward(region string, cfg UDPForwardConfig, ratelimit *RateLimit) *U sessionTimeout = defaultUDPSessionTimeout } - return &UDPForward{ - region: region, - listenAddr: cfg.ListenAddr, - readTimeout: time.Duration(readTimeout) * time.Second, - writeTimeout: time.Duration(writeTimeout) * time.Second, - sessionTimeout: sessionTimeout, - sessMgr: GetSessionManager(), - udpSessions: make(map[string]*udpSession), - ratelimit: ratelimit, + rateLimit := utils.NewRateLimit() + rateLimit.SetRateLimit(int64(cfg.RateLimit * 1024 * 1024)) + + p.region = cfg.Region + p.listenAddr = cfg.ListenAddr + p.writeTimeout = time.Duration(writeTimeout) * time.Second + p.readTimeout = time.Duration(readTimeout) * time.Second + p.sessionTimeout = time.Duration(sessionTimeout) * time.Second + p.udpSessions = make(map[string]*udpSession) + p.ratelimit = rateLimit + p.routeManager = route.GetRouteManager() + return nil +} + +func (p *TProxyUDP) initRedirect() error { + ipPort := strings.Split(p.listenAddr, ":") + if len(ipPort) != 2 { + return fmt.Errorf("invalid listen addr") } + + initRedirect("udp", p.region, ipPort[1]) + return nil } -// Listen listens an udp port, since that we use tproxy to +// ListenAndServe listens an udp port, since that we use tproxy to // redirect traffic to this listened udp port // so the socket should set to ip transparent option -func (f *UDPForward) Listen() (*net.UDPConn, error) { - laddr, err := net.ResolveUDPAddr("udp", f.listenAddr) +func (p *TProxyUDP) ListenAndServe() error { + laddr, err := net.ResolveUDPAddr("udp", p.listenAddr) if err != nil { - logs.Error("resolve udp fail: %v", err) - return nil, err + return err } lconn, err := net.ListenUDP("udp", laddr) if err != nil { - return nil, err + return err } // set socket with ip transparent option file, err := lconn.File() if err != nil { lconn.Close() - return nil, err + return err } defer file.Close() err = syscall.SetsockoptInt(int(file.Fd()), syscall.SOL_IP, syscall.IP_TRANSPARENT, 1) if err != nil { lconn.Close() - return nil, err + return err } // set socket with recv origin dst option err = syscall.SetsockoptInt(int(file.Fd()), syscall.SOL_IP, syscall.IP_RECVORIGDSTADDR, 1) if err != nil { - return nil, err + return err } // create raw socket fd // we use rawsocket to send udp packet back to client. rawfd, err := syscall.Socket(syscall.AF_INET, syscall.SOCK_RAW, syscall.IPPROTO_RAW) if err != nil || rawfd < 0 { - logs.Error("call socket fail: %v", err) - return nil, err + return err } err = syscall.SetsockoptInt(rawfd, syscall.IPPROTO_IP, syscall.IP_HDRINCL, 1) if err != nil { - return nil, err + return err } - f.rawfd = rawfd - return lconn, nil + p.rawfd = rawfd + return p.serve(lconn) } -func (f *UDPForward) Serve(lconn *net.UDPConn) error { - go f.recycleSession() +func (p *TProxyUDP) serve(lconn *net.UDPConn) error { + go p.recycleSession() buf := make([]byte, 64*1024) oob := make([]byte, 1024) for { @@ -142,7 +189,7 @@ func (f *UDPForward) Serve(lconn *net.UDPConn) error { break } - origindst, err := f.getOriginDst(oob[:oobn]) + origindst, err := p.getOriginDst(oob[:oobn]) if err != nil { logs.Error("get origin dst fail: %v", err) continue @@ -153,20 +200,20 @@ func (f *UDPForward) Serve(lconn *net.UDPConn) error { key := fmt.Sprintf("%s:%s:%s:%s", sip, sport, dip, dport) - f.udpsessLock.Lock() - udpsess := f.udpSessions[key] + p.udpsessLock.Lock() + udpsess := p.udpSessions[key] if udpsess != nil { udpsess.lastActive = time.Now() - f.udpsessLock.Unlock() + p.udpsessLock.Unlock() } else { - f.udpsessLock.Unlock() - sess := f.sessMgr.GetSession(f.region, dip) + p.udpsessLock.Unlock() + sess := p.routeManager.Route(p.region, dip) if sess == nil { logs.Error("no route to host: %s", dip) continue } - stream, err := sess.conn.OpenStream() + stream, err := sess.OpenStream() if err != nil { logs.Error("open stream fail: %v", err) continue @@ -174,12 +221,12 @@ func (f *UDPForward) Serve(lconn *net.UDPConn) error { logs.Debug("open new stream for %s", key) udpsess = &udpSession{stream, time.Now()} - f.udpsessLock.Lock() - f.udpSessions[key] = udpsess - f.udpsessLock.Unlock() + p.udpsessLock.Lock() + p.udpSessions[key] = udpsess + p.udpsessLock.Unlock() bytes := proto.EncodeProxyProtocol("udp", sip, sport, dip, dport) - stream.SetWriteDeadline(time.Now().Add(f.writeTimeout)) + stream.SetWriteDeadline(time.Now().Add(p.writeTimeout)) _, err = stream.Write(bytes) stream.SetWriteDeadline(time.Time{}) if err != nil { @@ -187,13 +234,13 @@ func (f *UDPForward) Serve(lconn *net.UDPConn) error { continue } - go f.forwardUDP(stream, key, origindst, raddr) + go p.doProxy(stream, key, origindst, raddr) } stream := udpsess.stream bytes := proto.EncodeData(buf[:nr]) - stream.SetWriteDeadline(time.Now().Add(f.writeTimeout)) + stream.SetWriteDeadline(time.Now().Add(p.writeTimeout)) _, err = stream.Write(bytes) stream.SetWriteDeadline(time.Time{}) if err != nil { @@ -203,13 +250,13 @@ func (f *UDPForward) Serve(lconn *net.UDPConn) error { return nil } -// forwardUDP reads from stream and write to tofd via rawsocket -func (f *UDPForward) forwardUDP(stream transport.Stream, sessionKey string, fromaddr, toaddr *net.UDPAddr) { +// doProxy reads from stream and write to tofd via rawsocket +func (p *TProxyUDP) doProxy(stream transport.Stream, sessionKey string, fromaddr, toaddr *net.UDPAddr) { defer stream.Close() defer func() { - f.udpsessLock.Lock() - delete(f.udpSessions, sessionKey) - f.udpsessLock.Unlock() + p.udpsessLock.Lock() + delete(p.udpSessions, sessionKey) + p.udpsessLock.Unlock() }() hdr := make([]byte, 2) @@ -228,7 +275,7 @@ func (f *UDPForward) forwardUDP(stream transport.Stream, sessionKey string, from nlen := binary.BigEndian.Uint16(hdr) buf := make([]byte, nlen) - stream.SetReadDeadline(time.Now().Add(f.readTimeout)) + stream.SetReadDeadline(time.Now().Add(p.readTimeout)) _, err = io.ReadFull(stream, buf) stream.SetReadDeadline(time.Time{}) if err != nil { @@ -236,36 +283,36 @@ func (f *UDPForward) forwardUDP(stream transport.Stream, sessionKey string, from break } - err = sendUDPViaRaw(f.rawfd, fromaddr, toaddr, buf) + err = utils.SendUDPViaRaw(p.rawfd, fromaddr, toaddr, buf) if err != nil { logs.Error("send via raw socket fail: %v", err) } - f.udpsessLock.Lock() - udpsess := f.udpSessions[sessionKey] + p.udpsessLock.Lock() + udpsess := p.udpSessions[sessionKey] if udpsess != nil { udpsess.lastActive = time.Now() } - f.udpsessLock.Unlock() + p.udpsessLock.Unlock() } } -func (f *UDPForward) recycleSession() { +func (p *TProxyUDP) recycleSession() { tick := time.NewTicker(time.Second * 5) for range tick.C { - f.udpsessLock.Lock() - for k, s := range f.udpSessions { - if time.Now().Sub(s.lastActive).Seconds() > float64(f.sessionTimeout) { + p.udpsessLock.Lock() + for k, s := range p.udpSessions { + if time.Now().Sub(s.lastActive).Seconds() > float64(p.sessionTimeout) { logs.Warn("remove udp session") s.stream.Close() - delete(f.udpSessions, k) + delete(p.udpSessions, k) } } - f.udpsessLock.Unlock() + p.udpsessLock.Unlock() } } -func (f *UDPForward) getOriginDst(hdr []byte) (*net.UDPAddr, error) { +func (p *TProxyUDP) getOriginDst(hdr []byte) (*net.UDPAddr, error) { msgs, err := syscall.ParseSocketControlMessage(hdr) if err != nil { return nil, err diff --git a/gtun/proxy/tun_proxy.go b/gtun/proxy/tun_proxy.go new file mode 100644 index 0000000..10e11bb --- /dev/null +++ b/gtun/proxy/tun_proxy.go @@ -0,0 +1,146 @@ +package proxy + +import ( + "encoding/binary" + "encoding/json" + "fmt" + "github.com/ICKelin/gtun/gtun/route" + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/gtun/internal/proto" + "github.com/ICKelin/gtun/internal/utils" + "github.com/ICKelin/optw/transport" + "io" + "time" +) + +func init() { + Register("tun_proxy", NewTunProxy) +} + +type TunProxyConfig struct { + Region string `json:"region"` + MTU int `json:"mtu"` + WriteTimeout int `json:"write_timeout"` + ReadTimeout int `json:"read_timeout"` +} + +type TunProxy struct { + config TunProxyConfig + dev *utils.Interface +} + +func NewTunProxy() Proxy { + return &TunProxy{} +} + +func (p *TunProxy) Name() string { + return "tun_proxy" +} + +func (p *TunProxy) Setup(cfg json.RawMessage) error { + var config = TunProxyConfig{} + err := json.Unmarshal(cfg, &config) + if err != nil { + return err + } + + if config.MTU <= 0 { + return fmt.Errorf("%s invalid mtu", p.Name()) + } + + dev, err := utils.NewInterface() + if err != nil { + return err + } + err = dev.SetMTU(config.MTU) + if err != nil { + return err + } + + err = dev.Up() + if err != nil { + return err + } + + p.config = config + p.dev = dev + return nil +} + +func (p *TunProxy) ListenAndServe() error { + // tun proxy use only one stream for long live connection + var nextHopStream transport.Stream + var nextHopConn *route.HopInfo + for { + buf, err := p.dev.Read() + if err != nil { + return err + } + + if nextHopConn == nil || nextHopConn.IsClosed() { + nextHopConn = route.GetRouteManager().Route(p.config.Region, "") + if nextHopConn == nil { + logs.Warn("route to next hop fail") + continue + } + + nextHopStream, err = nextHopConn.OpenStream() + if err != nil { + logs.Warn("open stream fail: %v", err) + continue + } + + // encode proxy protocol + bytes := proto.EncodeProxyProtocol("tun_proxy", "", "0", "", "0") + _ = nextHopStream.SetWriteDeadline(time.Now().Add(time.Duration(p.config.WriteTimeout))) + _, err = nextHopStream.Write(bytes) + _ = nextHopStream.SetWriteDeadline(time.Time{}) + + go p.readFromRemote(nextHopStream) + } + + bytes := proto.EncodeData(buf) + nextHopStream.SetWriteDeadline(time.Now().Add(time.Duration(p.config.WriteTimeout))) + _, err = nextHopStream.Write(bytes) + nextHopStream.SetWriteDeadline(time.Time{}) + if err != nil { + nextHopStream.Close() + nextHopConn.Close() + logs.Error("stream write fail: %v", err) + } + } +} + +func (p *TunProxy) readFromRemote(stream transport.Stream) { + defer stream.Close() + hdr := make([]byte, 2) + for { + nr, err := stream.Read(hdr) + if err != nil { + if err != io.EOF { + logs.Error("read stream fail %v", err) + } + break + } + if nr != 2 { + logs.Error("invalid bodylen: %d", nr) + continue + } + + nlen := binary.BigEndian.Uint16(hdr) + buf := make([]byte, nlen) + stream.SetReadDeadline(time.Now().Add(time.Duration(p.config.ReadTimeout))) + _, err = io.ReadFull(stream, buf) + stream.SetReadDeadline(time.Time{}) + if err != nil { + logs.Error("read stream body fail: %v", err) + break + } + + _, err = p.dev.Write(buf) + if err != nil { + logs.Warn("write to dev fail: %v", err) + return + } + } +} diff --git a/gtun/proxy/types.go b/gtun/proxy/types.go new file mode 100644 index 0000000..f839302 --- /dev/null +++ b/gtun/proxy/types.go @@ -0,0 +1,130 @@ +package proxy + +import ( + "bufio" + "encoding/json" + "fmt" + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/gtun/internal/utils" + "net/http" + "os" + "strings" + "time" +) + +var errRegistered = fmt.Errorf("already registered") +var errNotRegister = fmt.Errorf("proxy not register") +var ipsetNamePrefix = "GTUN-" + +// Proxy defines Proxies, such as tproxy_tcp, tproxy_udp,ip_tun, ip_wireguard +type Proxy interface { + Name() string + Setup(cfg json.RawMessage) error + ListenAndServe() error +} + +var registerProxy = make(map[string]func() Proxy) + +func Register(name string, constructor func() Proxy) error { + if _, ok := registerProxy[name]; ok { + return errRegistered + } + registerProxy[name] = constructor + return nil +} + +func Setup(region, ruleFile string, proxyConfigs map[string]string) error { + for name, config := range proxyConfigs { + constructor := registerProxy[name] + if constructor == nil { + return errNotRegister + } + p := constructor() + err := p.Setup([]byte(config)) + if err != nil { + return err + } + + AddFromFile(region, ruleFile) + go p.ListenAndServe() + } + return nil +} + +func AddIP(region string, ip string) error { + out, err := utils.ExecCmd("ipset", []string{"add", ipsetNamePrefix + region, ip}) + if err != nil { + return fmt.Errorf("add to ipset fail: %v %s", err, out) + } + return nil +} + +func DelIP(region, ip string) error { + out, err := utils.ExecCmd("ipset", []string{"del", ipsetNamePrefix + region, ip}) + if err != nil { + return fmt.Errorf("del from ipset fail: %v %s", err, out) + } + return nil +} + +func AddApp(region, appName string) error { + AddFromFile(region, appName) + return nil +} + +func AddFromFile(region, file string) { + ips := loadIPs(file) + + for _, ip := range ips { + AddIP(region, ip) + } +} + +func loadIPs(file string) []string { + if len(file) <= 0 { + return nil + } + + ips := make([]string, 0) + var br *bufio.Reader + if strings.HasPrefix(file, "http://") || strings.HasPrefix(file, "https://") { + // load from url + req, err := http.NewRequest("GET", file, nil) + if err != nil { + logs.Warn("load file fail: %v", err) + return nil + } + + cli := http.Client{ + Timeout: time.Second * 120, + } + + resp, err := cli.Do(req) + if err != nil { + logs.Warn("load file fail: %v", err) + return nil + } + + defer resp.Body.Close() + br = bufio.NewReader(resp.Body) + } else { + // load from file + fp, err := os.Open(file) + if err != nil { + logs.Warn("open rule file fail: %v", err) + return nil + } + defer fp.Close() + br = bufio.NewReader(fp) + } + + for { + line, _, err := br.ReadLine() + if err != nil { + break + } + ips = append(ips, string(line)) + } + + return ips +} diff --git a/gtun/route/connection.go b/gtun/route/connection.go new file mode 100644 index 0000000..4e2dde3 --- /dev/null +++ b/gtun/route/connection.go @@ -0,0 +1,68 @@ +package route + +import ( + "fmt" + "github.com/ICKelin/optw/transport/transport_api" + "time" + + "github.com/ICKelin/gtun/internal/logs" + "github.com/ICKelin/optw/transport" +) + +type ConnectionConfig struct { + Region string + ServerAddr string + AuthKey string +} + +type Connection struct { + dialer transport.Dialer + region string + scheme string + serverAddr string +} + +func CreateConnection(region, scheme, serverAddr, authKey string) (*Connection, error) { + dialer, err := transport_api.NewDialer(scheme, serverAddr, authKey) + if err != nil { + return nil, err + } + + return &Connection{ + dialer: dialer, + region: region, + scheme: scheme, + serverAddr: serverAddr, + }, nil +} + +func (c *Connection) ConnectNextHop() { + for { + conn, err := c.dialer.Dial() + if err != nil { + logs.Error("connect to %s fail: %v", c.String(), err) + time.Sleep(time.Second * 3) + continue + } + + logs.Info("connect to %s success", c.String()) + hopConn := &HopInfo{Conn: conn} + + // add next hop connection to route + GetRouteManager().AddRoute(c.region, hopConn) + tick := time.NewTicker(time.Second * 1) + for range tick.C { + if hopConn.IsClosed() { + break + } + } + + // delete next hop connection to route + GetRouteManager().DeleteRoute(c.region, hopConn) + logs.Warn("reconnect %s", c.String()) + } +} + +func (c *Connection) String() string { + return fmt.Sprintf("regions[%s] %s://%s", c.region, c.scheme, c.serverAddr) +} diff --git a/gtun/route/route.go b/gtun/route/route.go new file mode 100644 index 0000000..cc530d4 --- /dev/null +++ b/gtun/route/route.go @@ -0,0 +1,105 @@ +package route + +import ( + "github.com/ICKelin/gtun/internal/logs" + "strings" + "sync" + + "github.com/ICKelin/optw/transport" +) + +var routeManager = &Manager{ + regionHops: make(map[string][]*HopInfo), + raceManager: GetTraceManager(), +} + +type Manager struct { + raceManager *TraceManager + regionHopsMu sync.RWMutex + regionHops map[string][]*HopInfo +} + +type HopInfo struct { + transport.Conn +} + +func GetRouteManager() *Manager { + return routeManager +} + +func (routeManager *Manager) Route(region, dip string) *HopInfo { + routeManager.regionHopsMu.RLock() + defer routeManager.regionHopsMu.RUnlock() + + regionHops, ok := routeManager.regionHops[region] + if !ok { + return nil + } + + if len(regionHops) <= 0 { + return nil + } + + bestNode := routeManager.raceManager.GetBestNode(region) + bestIP := strings.Split(bestNode, ":")[0] + for i := 0; i < len(regionHops); i++ { + hop := regionHops[i] + if hop.IsClosed() { + logs.Warn("%s %s is closed", region, hop.RemoteAddr()) + continue + } + + if len(bestIP) != 0 { + // use only ip address for the same node + // TODO: use scheme://ip:port + hopIP := strings.Split(hop.RemoteAddr().String(), ":")[0] + if bestIP == hopIP { + logs.Debug("best ip match %s", bestIP) + return hop + } + } + } + + logs.Warn("use random hop") + hash := 0 + for _, c := range dip { + hash += int(c) + } + + hop := regionHops[hash%len(regionHops)] + if hop == nil || hop.IsClosed() { + return nil + } + return hop +} + +func (routeManager *Manager) AddRoute(region string, hop *HopInfo) { + routeManager.regionHopsMu.Lock() + defer routeManager.regionHopsMu.Unlock() + regionHops := routeManager.regionHops[region] + if regionHops == nil { + regionHops = make([]*HopInfo, 0) + } + regionHops = append(regionHops, hop) + routeManager.regionHops[region] = regionHops +} + +func (routeManager *Manager) DeleteRoute(region string, hop *HopInfo) { + routeManager.regionHopsMu.Lock() + defer routeManager.regionHopsMu.Unlock() + regionHops := routeManager.regionHops[region] + if regionHops == nil { + return + } + + hops := make([]*HopInfo, 0, len(regionHops)) + for _, s := range regionHops { + if s.RemoteAddr().String() == hop.RemoteAddr().String() { + continue + } + + hops = append(hops, s) + } + + routeManager.regionHops[region] = hops +} diff --git a/gtun/route/route_test.go b/gtun/route/route_test.go new file mode 100644 index 0000000..22b4f2b --- /dev/null +++ b/gtun/route/route_test.go @@ -0,0 +1,191 @@ +package route + +import ( + "github.com/ICKelin/optw/transport" + "github.com/agiledragon/gomonkey/v2" + . "github.com/smartystreets/goconvey/convey" + "net" + "testing" +) + +func TestManager_AddRoute(t *testing.T) { + Convey("Test add route", t, func() { + Convey("add first hop for region", func() { + GetRouteManager().AddRoute("test_region1", &HopInfo{}) + So(len(GetRouteManager().regionHops), ShouldEqual, 1) + So(len(GetRouteManager().regionHops["test_region1"]), ShouldEqual, 1) + + }) + + Convey("add second hop", func() { + GetRouteManager().AddRoute("test_region1", &HopInfo{}) + So(len(GetRouteManager().regionHops), ShouldEqual, 1) + So(len(GetRouteManager().regionHops["test_region1"]), ShouldEqual, 2) + }) + }) +} + +func TestManager_DeleteRoute(t *testing.T) { + Convey("Test delete route", t, func() { + Convey("delete un exist region", func() { + GetRouteManager().DeleteRoute("not-found", nil) + }) + + Convey("delete exist region with empty hops", func() { + GetRouteManager().regionHops["region1"] = make([]*HopInfo, 0) + GetRouteManager().DeleteRoute("region1", nil) + }) + + Convey("delete exist region with hops", func() { + newHopInfo := &HopInfo{Conn: &mockConn{}} + gomonkey.ApplyMethod(newHopInfo.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + return &net.TCPAddr{ + IP: net.IPv4(127, 0, 0, 1), + Port: 10000, + Zone: "", + } + }) + GetRouteManager().AddRoute("region1", newHopInfo) + So(len(GetRouteManager().regionHops["region1"]), ShouldEqual, 1) + GetRouteManager().DeleteRoute("region1", newHopInfo) + So(len(GetRouteManager().regionHops["region1"]), ShouldEqual, 0) + }) + + Convey("delete not exist hops", func() { + newHopInfo := &HopInfo{Conn: &mockConn{}} + i := 0 + gomonkey.ApplyMethod(newHopInfo.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + i += 1 + return &net.TCPAddr{ + IP: net.IPv4(127, 0, byte(i), 1), + Port: 10000, + Zone: "", + } + }) + + deleteHopInfo := &HopInfo{Conn: &mockConn{}} + gomonkey.ApplyMethod(deleteHopInfo.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + i += 1 + return &net.TCPAddr{ + IP: net.IPv4(127, 0, byte(i), 1), + Port: 10000, + Zone: "", + } + }) + + GetRouteManager().AddRoute("region1", newHopInfo) + So(len(GetRouteManager().regionHops["region1"]), ShouldEqual, 1) + + GetRouteManager().DeleteRoute("region1", deleteHopInfo) + So(len(GetRouteManager().regionHops["region1"]), ShouldEqual, 1) + }) + }) +} + +func TestManager_Route(t *testing.T) { + Convey("Test route", t, func() { + Convey("nil next hop region", func() { + hop := GetRouteManager().Route("not-found", "") + So(hop, ShouldBeNil) + + GetRouteManager().regionHops["region1"] = make([]*HopInfo, 0) + hop = GetRouteManager().Route("region1", "") + So(hop, ShouldBeNil) + }) + + Convey("next hop is closed", func() { + hop := &HopInfo{Conn: &mockConn{}} + gomonkey.ApplyMethod(hop.Conn, "IsClosed", func(conn transport.Conn) bool { + return true + }) + gomonkey.ApplyMethod(hop.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + return &net.TCPAddr{ + IP: net.IPv4(127, 0, byte(0), 1), + Port: 10000, + Zone: "", + } + }) + + GetRouteManager().AddRoute("region1", hop) + routeHop := GetRouteManager().Route("region1", "") + So(routeHop, ShouldBeNil) + }) + + Convey("best ip not match", func() { + hop := &HopInfo{Conn: &mockConn{}} + gomonkey.ApplyMethod(hop.Conn, "IsClosed", func(conn transport.Conn) bool { + return false + }) + gomonkey.ApplyMethod(hop.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + return &net.TCPAddr{ + IP: net.IPv4(127, 0, byte(0), 1), + Port: 10000, + Zone: "", + } + }) + + gomonkey.ApplyMethod(GetRouteManager().raceManager, "GetBestNode", func(manager *TraceManager) string { + return "192.168.1.1:9000" + }) + GetRouteManager().AddRoute("region2", hop) + routeHop := GetRouteManager().Route("region2", "") + // use random + So(routeHop, ShouldNotBeNil) + So(routeHop.RemoteAddr().String(), ShouldEqual, "127.0.0.1:10000") + }) + + Convey("best ip match", func() { + hop := &HopInfo{Conn: &mockConn{}} + gomonkey.ApplyMethod(hop.Conn, "IsClosed", func(conn transport.Conn) bool { + return false + }) + gomonkey.ApplyMethod(hop.Conn, "RemoteAddr", func(hopInfo transport.Conn) net.Addr { + return &net.TCPAddr{ + IP: net.IPv4(127, 0, byte(0), 1), + Port: 10000, + Zone: "", + } + }) + + gomonkey.ApplyMethod(GetRouteManager().raceManager, "GetBestNode", func(manager *TraceManager) string { + return "127.0.0.1:10000" + }) + + GetRouteManager().AddRoute("region3", hop) + routeHop := GetRouteManager().Route("region3", "") + So(routeHop, ShouldNotBeNil) + So(routeHop.RemoteAddr().String(), ShouldEqual, "127.0.0.1:10000") + }) + + Convey("random next hop", func() {}) + }) +} + +type mockConn struct{} + +func (m *mockConn) OpenStream() (transport.Stream, error) { + //TODO implement me + panic("implement me") +} + +func (m *mockConn) AcceptStream() (transport.Stream, error) { + //TODO implement me + panic("implement me") +} + +func (m *mockConn) Close() { + //TODO implement me + panic("implement me") +} + +func (m *mockConn) IsClosed() bool { + //TODO implement me + panic("implement me") +} + +func (m *mockConn) RemoteAddr() net.Addr { + //TODO implement me + panic("implement me") +} + +var _ transport.Conn = &mockConn{} diff --git a/gtun/race.go b/gtun/route/trace.go similarity index 66% rename from gtun/race.go rename to gtun/route/trace.go index 232a470..f1f2e5d 100644 --- a/gtun/race.go +++ b/gtun/route/trace.go @@ -1,4 +1,4 @@ -package gtun +package route import ( "encoding/binary" @@ -10,45 +10,36 @@ import ( "github.com/ICKelin/gtun/internal/logs" ) -var gRaceManager *RaceManager -var singleton sync.Once +var traceManager = &TraceManager{ + regionTrace: make(map[string]*Trace), +} -// RaceManager manage region race -type RaceManager struct { - regionRaceMu sync.Mutex - regionRace map[string]*Race +func GetTraceManager() *TraceManager { + return traceManager } -// NewRaceManager is a singleton of create a race manager -func NewRaceManager() *RaceManager { - singleton.Do(func() { - gRaceManager = &RaceManager{ - regionRace: make(map[string]*Race), - } - }) - return gRaceManager +// TraceManager manage region trace +type TraceManager struct { + regionTraceMu sync.Mutex + regionTrace map[string]*Trace +} + +func (m *TraceManager) RunRace() { + for _, race := range m.regionTrace { + go race.Run() + } } -// AddRegionRace adds a race instance for region -func (m *RaceManager) AddRegionRace(region string, race *Race) { - m.regionRaceMu.Lock() - defer m.regionRaceMu.Unlock() - m.regionRace[region] = race +// AddRegionTrace adds a trace instance for region +func (m *TraceManager) AddRegionTrace(region string, race *Trace) { + m.regionTraceMu.Lock() + defer m.regionTraceMu.Unlock() + m.regionTrace[region] = race } -// -//func (m *RaceManager) DeleteRegionNode(region, node string) { -// m.regionRaceMu.Lock() -// defer m.regionRaceMu.Unlock() -// race := m.RegionRace[region] -// if race == nil { -// return -// } -//} - -// GetBestNode returns the hightest score of region target region -func (m *RaceManager) GetBestNode(region string) string { - regionRace := m.regionRace[region] +// GetBestNode returns the highest score of region target region +func (m *TraceManager) GetBestNode(region string) string { + regionRace := m.regionTrace[region] if regionRace == nil { return "" } @@ -56,33 +47,35 @@ func (m *RaceManager) GetBestNode(region string) string { return regionRace.GetBestNode() } -// Race is a region race instance -type Race struct { +// Trace is a region trace instance +type Trace struct { + region string targets []string targetScoreMu sync.Mutex targetScore map[string]float64 totalRtt int32 } -// NewRace return race instance -func NewRace(targets []string) *Race { - return &Race{ +// NewTrace return trace instance +func NewTrace(region string, targets []string) *Trace { + return &Trace{ + region: region, targets: targets, targetScoreMu: sync.Mutex{}, targetScore: make(map[string]float64), } } -// Run race job -func (r *Race) Run() { - r.race() +// Run trace job +func (r *Trace) Run() { + r.trace() tick := time.NewTicker(time.Second * 120) for range tick.C { - r.race() + r.trace() } } -func (r *Race) race() { +func (r *Trace) trace() { for _, target := range r.targets { raddr, err := net.ResolveUDPAddr("udp", target) if err != nil { @@ -134,7 +127,8 @@ func (r *Race) race() { lossRank := r.calcLossScore(loss) delayRank := r.calcRttScore(rtt) score := lossRank + delayRank - logs.Debug("%s loss %d rtt %d lossRank %.4f delayRank %.4f score %.4f", target, loss, rtt, lossRank, delayRank, score) + logs.Debug("region[%s] %s loss %d rtt %d lossRank %.4f delayRank %.4f score %.4f", + r.region, target, loss, rtt, lossRank, delayRank, score) r.targetScoreMu.Lock() r.targetScore[remoteAddr] = score r.targetScoreMu.Unlock() @@ -146,7 +140,7 @@ func (r *Race) race() { // f(p) = 35+(1.25-p)x10 0.75% < p <= 1.25%, // f(p) = 30+(2.25-p)x5 1.25% < p <= 2.25%, // f(p) = 30+(p-2.25)x5x-1 p > 2.25% -func (r *Race) calcLossScore(loss int) float64 { +func (r *Trace) calcLossScore(loss int) float64 { lossRate := float64(loss) / 60 if 0 < lossRate && lossRate <= 0.75 { return 40 + (0.75-lossRate)*13 @@ -160,7 +154,7 @@ func (r *Race) calcLossScore(loss int) float64 { return 50 } -func (r *Race) calcRttScore(rtt int) float64 { +func (r *Trace) calcRttScore(rtt int) float64 { avgRtt := float64(rtt) / 60 if 0 < avgRtt && avgRtt < 45.0 { return 50 @@ -177,8 +171,8 @@ func (r *Race) calcRttScore(rtt int) float64 { return 0 } -// GetBestNode of all the targets of race -func (r *Race) GetBestNode() string { +// GetBestNode of all the targets of trace +func (r *Trace) GetBestNode() string { r.targetScoreMu.Lock() defer r.targetScoreMu.Unlock() bestScore := float64(-1) diff --git a/gtun/session.go b/gtun/session.go deleted file mode 100644 index 7d578de..0000000 --- a/gtun/session.go +++ /dev/null @@ -1,114 +0,0 @@ -package gtun - -import ( - "strings" - "sync" - - "github.com/ICKelin/gtun/internal/logs" - - "github.com/ICKelin/optw/transport" -) - -var sessionMgr = &SessionManager{ - sessions: make(map[string][]*Session), -} - -type SessionMap map[string]*Session - -type SessionManager struct { - rwmu sync.RWMutex - sessions map[string][]*Session - raceManager *RaceManager -} - -func GetSessionManager() *SessionManager { - return sessionMgr -} - -func (sessionMgr *SessionManager) SetRaceManager(raceManager *RaceManager) { - sessionMgr.raceManager = raceManager -} - -type Session struct { - conn transport.Conn - region string -} - -func newSession(conn transport.Conn, region string) *Session { - return &Session{ - conn: conn, - region: region, - } -} - -func (mgr *SessionManager) AddSession(region string, sess *Session) { - mgr.rwmu.Lock() - defer mgr.rwmu.Unlock() - regionSessions := mgr.sessions[region] - if regionSessions == nil { - regionSessions = make([]*Session, 0) - } - - regionSessions = append(regionSessions, sess) - mgr.sessions[region] = regionSessions -} - -func (mgr *SessionManager) GetSession(region, dip string) *Session { - mgr.rwmu.RLock() - defer mgr.rwmu.RUnlock() - - regionSessions, ok := mgr.sessions[region] - if !ok { - return nil - } - - if len(regionSessions) <= 0 { - return nil - } - - // get bestNode from race module - bestNode := mgr.raceManager.GetBestNode(region) - bestIP := strings.Split(bestNode, ":")[0] - for i := 0; i < len(regionSessions); i++ { - sess := regionSessions[i] - if sess.conn.IsClosed() { - logs.Warn("%s %s is closed", region, sess.conn.RemoteAddr()) - continue - } - - if len(bestIP) != 0 { - sessIP := strings.Split(sess.conn.RemoteAddr().String(), ":")[0] - if bestIP == sessIP { - logs.Debug("best ip match %s", bestIP) - return sess - } - } - } - - logs.Warn("use random session") - hash := 0 - for _, c := range dip { - hash += int(c) - } - return regionSessions[hash%len(regionSessions)] -} - -func (mgr *SessionManager) DeleteSession(region string, sess *Session) { - mgr.rwmu.Lock() - defer mgr.rwmu.Unlock() - regionSessions := mgr.sessions[region] - if regionSessions == nil { - return - } - - newSessions := make([]*Session, 0, len(regionSessions)) - for _, s := range regionSessions { - if s.conn.RemoteAddr().String() == sess.conn.RemoteAddr().String() { - continue - } - - newSessions = append(newSessions, s) - } - - mgr.sessions[region] = newSessions -} diff --git a/gtun/tcpforward.go b/gtun/tcpforward.go deleted file mode 100644 index 559c029..0000000 --- a/gtun/tcpforward.go +++ /dev/null @@ -1,210 +0,0 @@ -package gtun - -import ( - "fmt" - "io" - "net" - "sync" - "syscall" - "time" - - "github.com/ICKelin/gtun/internal/logs" - "github.com/ICKelin/gtun/internal/proto" -) - -var ( - // default tcp timeout(read, write), 10 seconds - defaultTCPTimeout = 10 -) - -type TCPForward struct { - region string - listenAddr string - - // writeTimeout defines the tcp connection write timeout in second - // default value set to 10 seconds - writeTimeout time.Duration - - // readTimeout defines the tcp connection write timeout in second - // default value set to 10 seconds - readTimeout time.Duration - - // the session manager is the global session manager - // it stores opennotr_client to opennotr_server connection - sessMgr *SessionManager - - mempool sync.Pool - - ratelimit *RateLimit -} - -func NewTCPForward(region string, cfg TCPForwardConfig, ratelimit *RateLimit) *TCPForward { - tcpReadTimeout := cfg.ReadTimeout - if tcpReadTimeout <= 0 { - tcpReadTimeout = defaultTCPTimeout - } - - tcpWriteTimeout := cfg.WriteTimeout - if tcpWriteTimeout <= 0 { - tcpWriteTimeout = int(defaultTCPTimeout) - } - - return &TCPForward{ - region: region, - listenAddr: cfg.ListenAddr, - writeTimeout: time.Duration(tcpWriteTimeout) * time.Second, - readTimeout: time.Duration(tcpReadTimeout) * time.Second, - sessMgr: GetSessionManager(), - mempool: sync.Pool{ - New: func() interface{} { - return make([]byte, 32*1024) - }, - }, - ratelimit: ratelimit, - } -} - -func (f *TCPForward) Listen() (net.Listener, error) { - listener, err := net.Listen("tcp", f.listenAddr) - if err != nil { - return nil, err - } - - // set socket with ip transparent option - file, err := listener.(*net.TCPListener).File() - if err != nil { - return nil, err - } - defer file.Close() - - err = syscall.SetsockoptInt(int(file.Fd()), syscall.SOL_IP, syscall.IP_TRANSPARENT, 1) - if err != nil { - return nil, err - } - return listener, nil -} - -func (f *TCPForward) Serve(listener net.Listener) error { - for { - conn, err := listener.Accept() - if err != nil { - logs.Error("accept fail: %v", err) - break - } - - go f.forwardTCP(conn) - } - - return nil -} - -func (f *TCPForward) forwardTCP(conn net.Conn) { - defer conn.Close() - - dip, dport, _ := net.SplitHostPort(conn.LocalAddr().String()) - sip, sport, _ := net.SplitHostPort(conn.RemoteAddr().String()) - - sess := f.sessMgr.GetSession(f.region, dip) - if sess == nil { - logs.Error("no route to host: %s", dip) - f.forwardDirect(conn, dip, dport) - return - } - logs.Debug("%s:%s=>%s:%s", sip, sport, dip, dport) - stream, err := sess.conn.OpenStream() - if err != nil { - logs.Error("open stream fail: %v", err) - f.forwardDirect(conn, dip, dport) - return - } - defer stream.Close() - - bytes := proto.EncodeProxyProtocol("tcp", sip, sport, dip, dport) - stream.SetWriteDeadline(time.Now().Add(f.writeTimeout)) - _, err = stream.Write(bytes) - stream.SetWriteDeadline(time.Time{}) - if err != nil { - logs.Error("stream write fail: %v", err) - f.forwardDirect(conn, dip, dport) - return - } - - wg := &sync.WaitGroup{} - wg.Add(1) - defer wg.Wait() - - go func() { - defer wg.Done() - defer stream.Close() - defer conn.Close() - obj := f.mempool.Get() - defer f.mempool.Put(obj) - buf := obj.([]byte) - io.CopyBuffer(stream, conn, buf) - }() - - obj := f.mempool.Get() - defer f.mempool.Put(obj) - buf := obj.([]byte) - io.CopyBuffer(conn, stream, buf) -} - -func (f *TCPForward) forwardDirect(conn net.Conn, dip, dport string) { - rconn, err := net.Dial("tcp", fmt.Sprintf("%s:%s", dip, dport)) - if err != nil { - logs.Error("forward direct fail: %v", err) - return - } - defer rconn.Close() - - wg := &sync.WaitGroup{} - wg.Add(1) - defer wg.Wait() - - go func() { - defer wg.Done() - defer rconn.Close() - defer conn.Close() - obj := f.mempool.Get() - defer f.mempool.Put(obj) - buf := obj.([]byte) - copyBuffer(rconn, conn, buf, f.ratelimit) - }() - - obj := f.mempool.Get() - defer f.mempool.Put(obj) - buf := obj.([]byte) - copyBuffer(conn, rconn, buf, f.ratelimit) -} - -func copyBuffer(dst io.Writer, src io.Reader, buf []byte, limiter *RateLimit) (written int64, err error) { - for { - nr, er := src.Read(buf) - if nr > 0 { - limiter.LimitRate(int64((nr))) - nw, ew := dst.Write(buf[0:nr]) - if nw < 0 || nr < nw { - nw = 0 - if ew == nil { - ew = fmt.Errorf("invalid write") - } - } - written += int64(nw) - if ew != nil { - err = ew - break - } - if nr != nw { - err = io.ErrShortWrite - break - } - } - if er != nil { - if er != io.EOF { - err = er - } - break - } - } - return written, err -} diff --git a/gtund/server.go b/gtund/server.go index 7f99a38..251e0ae 100644 --- a/gtund/server.go +++ b/gtund/server.go @@ -4,6 +4,7 @@ import ( "encoding/binary" "encoding/json" "fmt" + "github.com/ICKelin/gtun/internal/utils" "io" "net" "sync" @@ -27,9 +28,11 @@ type ServerConfig struct { } type Server struct { - listener transport.Listener - udpPool sync.Pool - tcpPool sync.Pool + listener transport.Listener + dev *utils.Interface + devStream transport.Stream + udpPool sync.Pool + tcpPool sync.Pool } func NewServer(listener transport.Listener) *Server { @@ -48,6 +51,10 @@ func NewServer(listener transport.Listener) *Server { } } +func (s *Server) SetTunDevice(dev *utils.Interface) { + s.dev = dev +} + func (s *Server) Run() error { for { conn, err := s.listener.Accept() @@ -109,6 +116,15 @@ func (s *Server) handleStream(stream transport.Stream) { s.tcpProxy(stream, &proxyProtocol) case "udp": s.udpProxy(stream, &proxyProtocol) + case "tun": + if s.devStream != nil { + s.devStream.Close() + s.devStream = stream + } else { + s.devStream = stream + go s.readDev() + } + s.tunProxy(stream, &proxyProtocol) } } @@ -139,7 +155,7 @@ func (s *Server) tcpProxy(stream transport.Stream, p *proto.ProxyProtocol) { } func (s *Server) udpProxy(stream transport.Stream, p *proto.ProxyProtocol) { - addr := net.JoinHostPort(p.DstPort, p.DstPort) + addr := net.JoinHostPort(p.DstIP, p.DstPort) raddr, err := net.ResolveUDPAddr("udp", addr) if err != nil { logs.Error("resolve %s fail: %v", addr, err) @@ -204,3 +220,44 @@ func (s *Server) udpProxy(stream transport.Stream, p *proto.ProxyProtocol) { } } } + +func (s *Server) tunProxy(stream transport.Stream, p *proto.ProxyProtocol) { + defer stream.Close() + hdr := make([]byte, 2) + for { + _, err := io.ReadFull(stream, hdr) + if err != nil { + logs.Error("read stream fail: %v", err) + break + } + nlen := binary.BigEndian.Uint16(hdr) + buf := make([]byte, nlen) + _, err = io.ReadFull(stream, buf) + if err != nil { + logs.Error("read stream body fail: %v", err) + break + } + + _, err = s.dev.Write(buf) + if err != nil { + logs.Error("write to dev fail: %v", err) + return + } + } +} + +func (s *Server) readDev() { + for { + buf, err := s.dev.Read() + if err != nil { + logs.Error("read interface fail: %v", err) + return + } + + bytes := proto.EncodeData(buf) + _, err = s.devStream.Write(bytes) + if err != nil { + logs.Error("stream write fail: %v", err) + } + } +} diff --git a/install.sh b/install.sh index e69de29..3465714 100644 --- a/install.sh +++ b/install.sh @@ -0,0 +1,9 @@ +echo "add no proxy address" +ipset create GTUN-NOPROXY hash:net +iptables -t mangle -I PREROUTING -m set --match-set GTUN-NOPROXY dst -j ACCEPT +iptables -t mangle -I OUTPUT -m set --match-set GTUN-NOPROXY dst -j ACCEPT + +echo "start gtun" +nohup ./gtun-linux-amd64 -c gtun.yaml & + +echo "start success." \ No newline at end of file diff --git a/gtun/net.go b/internal/utils/net.go similarity index 95% rename from gtun/net.go rename to internal/utils/net.go index e8ce3fb..8f41275 100644 --- a/gtun/net.go +++ b/internal/utils/net.go @@ -1,4 +1,4 @@ -package gtun +package utils import ( "fmt" @@ -37,7 +37,7 @@ func CheckSum(buf []byte) uint16 { return checksumWrapper(checksumAdd(buf, 0)) } -func sendUDPViaRaw(fd int, src, dst *net.UDPAddr, payload []byte) error { +func SendUDPViaRaw(fd int, src, dst *net.UDPAddr, payload []byte) error { iplen, ulen := uint16(28+len(payload)), uint16(8+len(payload)) if iplen > 65535 { return fmt.Errorf("too big packet") diff --git a/gtun/ratelimit.go b/internal/utils/ratelimit.go similarity index 99% rename from gtun/ratelimit.go rename to internal/utils/ratelimit.go index a96ef80..0e28248 100644 --- a/gtun/ratelimit.go +++ b/internal/utils/ratelimit.go @@ -1,4 +1,4 @@ -package gtun +package utils // Package ratelimit provides an efficient token bucket implementation // that can be used to limit the rate of arbitrary things. diff --git a/internal/utils/tun.go b/internal/utils/tun.go new file mode 100644 index 0000000..acbde35 --- /dev/null +++ b/internal/utils/tun.go @@ -0,0 +1,85 @@ +package utils + +import ( + "fmt" + "github.com/ICKelin/gtun/internal/logs" + "os/exec" + "runtime" + "time" + + "github.com/songgao/water" +) + +type Interface struct { + tun *water.Interface +} + +func NewInterface() (*Interface, error) { + iface := &Interface{} + + ifconfig := water.Config{ + DeviceType: water.TUN, + } + + for i := 0; i < 10; i++ { + ifconfig.Name = fmt.Sprintf("gtun.%d", i) + + ifce, err := water.New(ifconfig) + if err != nil { + logs.Error("new interface %s fail: %v", ifconfig.Name, err) + time.Sleep(time.Second * 1) + continue + } + + iface.tun = ifce + return iface, nil + } + return nil, fmt.Errorf("new interface %s fail", ifconfig.Name) +} + +func (iface *Interface) SetMTU(mtu int) error { + out, err := ExecCmd("ifconfig", []string{iface.tun.Name(), "mtu", fmt.Sprintf("%d", mtu)}) + if err != nil { + return fmt.Errorf("set mtu fail: %s %v", out, err) + } + return nil +} + +func (iface *Interface) Up() error { + switch runtime.GOOS { + case "linux": + out, err := ExecCmd("ifconfig", []string{iface.tun.Name(), "up"}) + if err != nil { + return fmt.Errorf("ifconfig fail: %s %v", out, err) + } + + default: + return fmt.Errorf("unsupported: %s %s", runtime.GOOS, runtime.GOARCH) + + } + + return nil +} + +func (iface *Interface) Read() ([]byte, error) { + buf := make([]byte, 2048) + n, err := iface.tun.Read(buf) + if err != nil { + return nil, err + } + + return buf[:n], nil +} + +func (iface *Interface) Write(buf []byte) (int, error) { + return iface.tun.Write(buf) +} + +func (iface *Interface) Close() { + iface.tun.Close() +} + +func ExecCmd(cmd string, args []string) (string, error) { + b, err := exec.Command(cmd, args...).CombinedOutput() + return string(b), err +} diff --git a/uninstall.sh b/uninstall.sh new file mode 100644 index 0000000..00dd705 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,7 @@ +echo "add no proxy address" +iptables -t mangle -D PREROUTING -m set --match-set GTUN-NOPROXY dst -j ACCEPT +iptables -t mangle -D OUTPUT -m set --match-set GTUN-NOPROXY dst -j ACCEPT +ipset destroy GTUN-NOPROXY + +echo "stop gtun" +killall gtun-linux_amd64 \ No newline at end of file