Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TunaMeasureBandwidthBytes config #68

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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