diff --git a/component/outbound/dialer_group_test.go b/component/outbound/dialer_group_test.go index f1fa08c74..8374d0b8e 100644 --- a/component/outbound/dialer_group_test.go +++ b/component/outbound/dialer_group_test.go @@ -13,6 +13,7 @@ import ( "github.com/daeuniverse/dae/component/outbound/dialer" "github.com/daeuniverse/dae/pkg/logger" "github.com/daeuniverse/outbound/pkg/fastrand" + "github.com/sirupsen/logrus" ) const ( @@ -26,7 +27,11 @@ var TestNetworkType = &dialer.NetworkType{ IsDns: false, } -var log = logger.NewLogger("trace", false, nil) +var log = logrus.New() + +func init() { + logger.SetLogger(log, "trace", false, nil) +} func newDirectDialer(option *dialer.GlobalOption, fullcone bool) *dialer.Dialer { _d, p := dialer.NewDirectDialer(option, true) diff --git a/config/config.go b/config/config.go index ba990fd6e..f7b34b66b 100644 --- a/config/config.go +++ b/config/config.go @@ -43,9 +43,8 @@ type Global struct { UtlsImitate string `mapstructure:"utls_imitate" default:"chrome_auto"` PprofPort uint16 `mapstructure:"pprof_port" default:"0"` Mptcp bool `mapstructure:"mptcp" default:"false"` - // TODO: support input in human-readable format (e.g., 100Mbps, 1Gbps) - BandwidthMaxTx uint64 `mapstructure:"bandwidth_max_tx" default:"0"` - BandwidthMaxRx uint64 `mapstructure:"bandwidth_max_rx" default:"0"` + BandwidthMaxTx string `mapstructure:"bandwidth_max_tx" default:"0"` + BandwidthMaxRx string `mapstructure:"bandwidth_max_rx" default:"0"` } type Utls struct { diff --git a/example.dae b/example.dae index 6e643cb00..711565356 100644 --- a/example.dae +++ b/example.dae @@ -102,10 +102,11 @@ global { # effects when the node supports MPTCP. It can use for load balance and failover to multiple interfaces and IPs. mptcp: false - # The maximum bandwidth for accessing the Internet. It is useful for some specific protocols (e.g., Hysteria2), - # which will perform better with bandwith information provided. The unit is **byte** per second. - bandwidth_max_tx: 26214400 # 200Mbps == 25MB/s == 26214400 B/s uplink - bandwidth_max_rx: 131072000 # 1Gbps == 125MB/s == 131072000 B/s downlink + # The maximum bandwidth for accessing the Internet. It is useful for some specific protocols (e.g., Hysteria2), + # which will perform better with bandwith information provided. The unit can be b, kb, mb, gb, tb or bytes per second. + # supported formats: https://v2.hysteria.network/docs/advanced/Full-Client-Config/#bandwidth + bandwidth_max_tx: '200 mbps' # uplink, or '200 m' or '200 mb' or '200 mbps' or 25000000(which is 200/8*1000*1000) + bandwidth_max_rx: '1 gbps' # downlink, or '1 g' or '1 gb' or '1 gbps' or 125000000(which is 1000/8*1000*1000) } # Subscriptions defined here will be resolved as nodes and merged as a part of the global node pool. diff --git a/go.mod b/go.mod index f24932026..052eaf10f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/bits-and-blooms/bloom/v3 v3.7.0 github.com/cilium/ebpf v0.15.0 github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c27619b592d - github.com/daeuniverse/outbound v0.0.0-20240928042419-b1e258193113 + github.com/daeuniverse/outbound v0.0.0-20241026154416-424675853298 github.com/fsnotify/fsnotify v1.7.0 github.com/json-iterator/go v1.1.12 github.com/mholt/archiver/v3 v3.5.1 diff --git a/go.sum b/go.sum index 33d6bea35..b9938fd1f 100644 --- a/go.sum +++ b/go.sum @@ -28,6 +28,8 @@ github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c276 github.com/daeuniverse/dae-config-dist/go/dae_config v0.0.0-20230604120805-1c27619b592d/go.mod h1:VGWGgv7pCP5WGyHGUyb9+nq/gW0yBm+i/GfCNATOJ1M= github.com/daeuniverse/outbound v0.0.0-20240928042419-b1e258193113 h1:m2GVle7Mdllco1bUshzvFz4RXI+2Nif1mTGaJsE91+w= github.com/daeuniverse/outbound v0.0.0-20240928042419-b1e258193113/go.mod h1:aR0y8VzpD7RJ5ZGD5ooe0MC6wfTzkIEYaGyxztJqG94= +github.com/daeuniverse/outbound v0.0.0-20241026154416-424675853298 h1:MSTgM94DnFdOKO3/m0UjTwGML7Fv7EJe7c5OL4YmymI= +github.com/daeuniverse/outbound v0.0.0-20241026154416-424675853298/go.mod h1:aR0y8VzpD7RJ5ZGD5ooe0MC6wfTzkIEYaGyxztJqG94= github.com/daeuniverse/quic-go v0.0.0-20240413031024-943f218e0810 h1:YtEYouFaNrg9sV9vf3UabvKShKn6sD0QaCdOxCwaF3g= github.com/daeuniverse/quic-go v0.0.0-20240413031024-943f218e0810/go.mod h1:61o2uZUGLrlv1i+oO2rx9sVX0vbf8cHzdSHt7h6lMnM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=