Skip to content

Commit

Permalink
Add TunaMeasureBandwidthBytes config
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Jul 14, 2023
1 parent 65cf266 commit 7d1e3cf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type Config struct {
TunaGeoDBPath string `json:"tunaGeoDBPath,omitempty" long:"tuna-geo-db-path" description:"(server only) Path to store Tuna geo db" default:"."`
TunaDisableMeasureBandwidth bool `json:"tunaDisableMeasureBandwidth,omitempty" long:"tuna-disable-measure-bandwidth" description:"(server only) Disable Tuna measure bandwidth when selecting service nodes"`
TunaMeasureStoragePath string `json:"tunaMeasureStoragePath,omitempty" long:"tuna-measure-storage-path" description:"(server only) Path to store Tuna measurement results" default:"."`
TunaMeasureBandwidthBytes int32 `json:"tunaMeasureBandwidthBytes,omitempty" long:"tuna-measure-bandwidth-bytes" description:"(server only) Tuna measure bandwidth bytes to transmit when selecting service nodes" default:"1"`

// UDP config
UDP bool `json:"udp,omitempty" long:"udp" description:"Support udp proxy"`
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ require (
github.com/jessevdk/go-flags v1.5.0
github.com/nknorg/ncp-go v1.0.6-0.20230228002512-f4cd1740bebd
github.com/nknorg/nkn-sdk-go v1.4.6-0.20230404044330-ad192f36d07e
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230512052928-f91bbbdcdaf6
github.com/nknorg/nkn-tunnel v0.3.5-0.20230621222635-47610787d9ae
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230714232320-9731b0d0271e
github.com/nknorg/nkn-tunnel v0.3.5-0.20230714234115-9f9532fad9f5
github.com/nknorg/nkn/v2 v2.2.0
github.com/nknorg/nkngomobile v0.0.0-20220615081414-671ad1afdfa9
github.com/nknorg/tuna v0.0.0-20230405223335-eb60c60c5953
github.com/nknorg/tuna v0.0.0-20230713132943-1604365ad8c9
github.com/shadowsocks/go-shadowsocks2 v0.1.2
github.com/stretchr/testify v1.8.1
github.com/txthinking/brook v0.0.0-20230418095906-76ced63f1803
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ github.com/nknorg/ncp-go v1.0.6-0.20230228002512-f4cd1740bebd h1:ZAXKeWKjkbS9QQh
github.com/nknorg/ncp-go v1.0.6-0.20230228002512-f4cd1740bebd/go.mod h1:T7ThlxmBjVIv3Ll3gJOHbQTuAFN3ZCYWvbux6JOX5wQ=
github.com/nknorg/nkn-sdk-go v1.4.6-0.20230404044330-ad192f36d07e h1:lWKUEfqOJ9NImCX60Bden+Y6VgRDhlx4gc6B09S32RQ=
github.com/nknorg/nkn-sdk-go v1.4.6-0.20230404044330-ad192f36d07e/go.mod h1:mnI1+17p2cI+5wv+3CWRyCjSALqUg5k1jTaWC2h0f/M=
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230512052928-f91bbbdcdaf6 h1:S+HzmSp4Yd97+X9xZ5AmcQgkbstEry+hfl8O42dX/kA=
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230512052928-f91bbbdcdaf6/go.mod h1:47W1/1axI4aOkQKtkjjRHW1x2SYrdCRI49LdPWf9vMc=
github.com/nknorg/nkn-tunnel v0.3.5-0.20230621222635-47610787d9ae h1:cuexnKy8/RWm6WBIjqCjaGd/cUHDB1wQsTWiOR2Eagw=
github.com/nknorg/nkn-tunnel v0.3.5-0.20230621222635-47610787d9ae/go.mod h1:rOxPIUgtFwsZG1DEJM6mm/AfH3Z+le+oSEv8WhZ2LQA=
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230714232320-9731b0d0271e h1:cClK7JrQaFbgzCEFYr3+0LCegQni/ZT5Q0gllN2mP2c=
github.com/nknorg/nkn-tuna-session v0.2.6-0.20230714232320-9731b0d0271e/go.mod h1:7WqPG+3rQTW8RiqXopgNqwKp3PFVV/zcoHomH7X8V2A=
github.com/nknorg/nkn-tunnel v0.3.5-0.20230714234115-9f9532fad9f5 h1:i7VZ2bCbpSs7/sgyEoiZHReqRbm4bFmjf0CQwsjeFoU=
github.com/nknorg/nkn-tunnel v0.3.5-0.20230714234115-9f9532fad9f5/go.mod h1:fw7qTKkPNhnmZ5rypS09PRQOi16d42+2QsRUuKPWsN0=
github.com/nknorg/nkn/v2 v2.2.0 h1:sXOawvVF/T3bBTuWbzBCyrGuxldA3be+f+BDjoWcOEA=
github.com/nknorg/nkn/v2 v2.2.0/go.mod h1:yv3jkg0aOtN9BDHS4yerNSZJtJNBfGvlaD5K6wL6U3E=
github.com/nknorg/nkngomobile v0.0.0-20220615081414-671ad1afdfa9 h1:Gr37j7Ttvcn8g7TdC5fs6Y6IJKdmfqCvj03UbsrS77o=
github.com/nknorg/nkngomobile v0.0.0-20220615081414-671ad1afdfa9/go.mod h1:zNY9NCyBcJCCDrXhwOjKarkW5cngPs/Z82xVNy/wvEA=
github.com/nknorg/tuna v0.0.0-20230405223335-eb60c60c5953 h1:nF2hRLsUZ+m6kB+LkLVdzlMKU2oFR2Q1qWtHw+0zBiQ=
github.com/nknorg/tuna v0.0.0-20230405223335-eb60c60c5953/go.mod h1:Ngge8vIVM0DPmy6xCT19/zXR3y7FsgiWsyX4V+Uq848=
github.com/nknorg/tuna v0.0.0-20230713132943-1604365ad8c9 h1:9g/qZ56Vut7njbtnfU8gQXonEDbTn8S3fCbEva9dLDY=
github.com/nknorg/tuna v0.0.0-20230713132943-1604365ad8c9/go.mod h1:Ngge8vIVM0DPmy6xCT19/zXR3y7FsgiWsyX4V+Uq848=
github.com/onsi/ginkgo/v2 v2.2.0 h1:3ZNA3L1c5FYDFTTxbFeVGGD8jYvjYauHD30YgLxVsNI=
github.com/onsi/ginkgo/v2 v2.2.0/go.mod h1:MEH45j8TBi6u9BMogfbp0stKC5cdGjumZj5Y7AG4VIk=
github.com/onsi/gomega v1.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q=
Expand Down
23 changes: 12 additions & 11 deletions nconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,17 +209,18 @@ func NewNconnect(opts *config.Opts) (*nconnect, error) {
}

tsConfig := &ts.Config{
TunaMaxPrice: opts.TunaMaxPrice,
TunaMinNanoPayFee: opts.TunaMinFee,
TunaNanoPayFeeRatio: opts.TunaFeeRatio,
TunaIPFilter: &geo.IPFilter{Allow: allowedIP, Disallow: disallowedIP},
TunaNknFilter: &filter.NknFilter{Allow: allowedNknAddrs, Disallow: disallowedNknAddrs},
TunaServiceName: opts.TunaServiceName,
TunaDownloadGeoDB: !opts.TunaDisableDownloadGeoDB,
TunaGeoDBPath: opts.TunaGeoDBPath,
TunaMeasureBandwidth: !opts.TunaDisableMeasureBandwidth,
TunaMeasureStoragePath: opts.TunaMeasureStoragePath,
TunaMinBalance: opts.TunaMinBalance,
TunaMaxPrice: opts.TunaMaxPrice,
TunaMinNanoPayFee: opts.TunaMinFee,
TunaNanoPayFeeRatio: opts.TunaFeeRatio,
TunaIPFilter: &geo.IPFilter{Allow: allowedIP, Disallow: disallowedIP},
TunaNknFilter: &filter.NknFilter{Allow: allowedNknAddrs, Disallow: disallowedNknAddrs},
TunaServiceName: opts.TunaServiceName,
TunaDownloadGeoDB: !opts.TunaDisableDownloadGeoDB,
TunaGeoDBPath: opts.TunaGeoDBPath,
TunaMeasureBandwidth: !opts.TunaDisableMeasureBandwidth,
TunaMeasureStoragePath: opts.TunaMeasureStoragePath,
TunaMeasurementBytesDownLink: opts.TunaMeasureBandwidthBytes,
TunaMinBalance: opts.TunaMinBalance,
}

if opts.SessionWindowSize > 0 {
Expand Down

0 comments on commit 7d1e3cf

Please sign in to comment.