diff --git a/go.mod b/go.mod index 269d83a..3eaa896 100644 --- a/go.mod +++ b/go.mod @@ -2,23 +2,21 @@ module slimming go 1.19 -require github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 - require ( - github.com/474420502/check v0.0.1 // indirect - github.com/klauspost/compress v1.15.9 // indirect + github.com/474420502/check v0.0.1 + github.com/klauspost/compress v1.15.9 + github.com/songgao/water v0.0.0-20200317203138-2b4b6d7c09d8 ) require ( - github.com/474420502/perfectshutdown v0.3.1 - github.com/474420502/random v0.5.1 - github.com/golang/protobuf v1.5.2 // indirect - github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091 // indirect + github.com/474420502/perfectshutdown v0.3.2 + github.com/golang/protobuf v1.5.2 + github.com/songgao/packets v0.0.0-20160404182456-549a10cd4091 golang.org/x/net v0.0.0-20220822230855-b0a4917ee28c // indirect golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect - google.golang.org/grpc v1.48.0 // indirect - google.golang.org/protobuf v1.28.1 // indirect + google.golang.org/grpc v1.48.0 + google.golang.org/protobuf v1.28.1 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index ff734c2..117753c 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/474420502/check v0.0.1 h1:JliRiu5sLCd5Xo3Dh0lZqVT/3M8iHRNm/wkjgM3s/wk= github.com/474420502/check v0.0.1/go.mod h1:W4LYCKwmpJsZMfWy24YrlC18bV7tuJVhiWHkXSAq1Bg= -github.com/474420502/perfectshutdown v0.3.1 h1:HFWr5pfcKOHnEe39B5PFKw2ipHCr3jKDPEvuTFMHqeo= -github.com/474420502/perfectshutdown v0.3.1/go.mod h1:qonD0eLCz1ncQq8heGQHbPdLlh30lofF2ISzV5ASW8A= -github.com/474420502/random v0.5.1 h1:AA/r690QEKiVdCsFD9OKbjUmmtmLJQ7Qxd4IMVV1sbc= -github.com/474420502/random v0.5.1/go.mod h1:Kq5VC8ezVvzp9CUahvebIdlSiFdHzEzscaOScLvbw2c= +github.com/474420502/perfectshutdown v0.3.2 h1:KKzK9Fu4gYs2eEW2Nr3lTgwN7chP5+Jn6f0Dx38HSiE= +github.com/474420502/perfectshutdown v0.3.2/go.mod h1:qonD0eLCz1ncQq8heGQHbPdLlh30lofF2ISzV5ASW8A= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -47,6 +45,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/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.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -103,6 +102,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= 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/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -134,6 +134,7 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= diff --git a/netcard.go b/netcard.go index e1e1da7..9780cb9 100644 --- a/netcard.go +++ b/netcard.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "net" + "os" "os/exec" gen "slimming/proto/gen" "strings" @@ -38,6 +39,10 @@ func NewNetTunnel() *NetTunnel { ipv4key: config.CurrentNodeKey, } + nt.shutdown.OnClose(func() { + os.Exit(0) + }) + for ipv4, address := range config.IPv4Nodes { nt.clients.Store(ipv4, NewRPCClient(address)) }