From c475a5e9307271375a9fb317e3aae30c7adab82b Mon Sep 17 00:00:00 2001 From: Yilun Date: Fri, 16 Oct 2020 18:01:48 -0700 Subject: [PATCH] Add config for downloading geo db Signed-off-by: Yilun --- client.go | 2 ++ config.go | 4 ++++ go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index 0b270bc..7d67398 100644 --- a/client.go +++ b/client.go @@ -128,6 +128,8 @@ func (c *TunaSessionClient) Listen(addrsRe *nkn.StringArray) error { ReverseServiceName: c.config.TunaServiceName, ReverseSubscriptionPrefix: c.config.TunaSubscriptionPrefix, ReverseIPFilter: *c.config.TunaIPFilter, + DownloadGeoDB: c.config.TunaDownloadGeoDB, + GeoDBPath: c.config.TunaGeoDBPath, DialTimeout: int32(dialTimeout), } diff --git a/config.go b/config.go index c9c60a8..82c9b07 100644 --- a/config.go +++ b/config.go @@ -15,6 +15,8 @@ type Config struct { TunaServiceName string TunaSubscriptionPrefix string TunaIPFilter *geo.IPFilter + TunaDownloadGeoDB bool + TunaGeoDBPath string SessionConfig *ncp.Config } @@ -26,6 +28,8 @@ var defaultConfig = Config{ TunaServiceName: tuna.DefaultReverseServiceName, TunaSubscriptionPrefix: tuna.DefaultSubscriptionPrefix, TunaIPFilter: nil, + TunaDownloadGeoDB: false, + TunaGeoDBPath: "", SessionConfig: nil, } diff --git a/go.mod b/go.mod index ed3fb99..987c567 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/nknorg/ncp-go v1.0.3 github.com/nknorg/nkn-sdk-go v1.3.3 github.com/nknorg/nkn/v2 v2.0.6 - github.com/nknorg/tuna v0.0.0-20201017002434-416a41ed7b56 + github.com/nknorg/tuna v0.0.0-20201017005948-d500a3d9970a github.com/patrickmn/go-cache v2.1.0+incompatible golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 ) diff --git a/go.sum b/go.sum index b7fd40e..796ac46 100644 --- a/go.sum +++ b/go.sum @@ -254,8 +254,8 @@ github.com/nknorg/nnet v0.0.0-20200521002812-357d1b11179f h1:JvDKr6D9LdnsdScND+8 github.com/nknorg/nnet v0.0.0-20200521002812-357d1b11179f/go.mod h1:4DHEQEMhlRGIKGSyhATdjeusdqaHafDatadtpeHBpvI= github.com/nknorg/portmapper v0.0.0-20200114081049-1c03cdccc283 h1:uS3/DvxCbi0zZau66ggQAgEjyGmql2mj77UQFgumq1I= github.com/nknorg/portmapper v0.0.0-20200114081049-1c03cdccc283/go.mod h1:dL4PQJ4670oTO6LqvkjrBQEkD+iMiOYjlKRBBw55Csg= -github.com/nknorg/tuna v0.0.0-20201017002434-416a41ed7b56 h1:WeWh2H1Lj5sEC0VHVZ8SaP5AqYYDO3YQqxX4mRkhvhU= -github.com/nknorg/tuna v0.0.0-20201017002434-416a41ed7b56/go.mod h1:t2GI4ZY5NSKEGSxIjIF4t72Tk/4jKBXDPdm2yjE4s+Y= +github.com/nknorg/tuna v0.0.0-20201017005948-d500a3d9970a h1:Ax7jxjvld67qozJXk4g1gPbGVvq9s14FzOi0OtmOL6Q= +github.com/nknorg/tuna v0.0.0-20201017005948-d500a3d9970a/go.mod h1:t2GI4ZY5NSKEGSxIjIF4t72Tk/4jKBXDPdm2yjE4s+Y= github.com/nrdcg/auroradns v1.0.1/go.mod h1:y4pc0i9QXYlFCWrhWrUSIETnZgrf4KuwjDIWmmXo3JI= github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= github.com/nrdcg/goinwx v0.7.0/go.mod h1:4tKJOCi/1lTxuw9/yB2Ez0aojwtUCSkckjc22eALpqE=