feat: add inbound-mptcp
for listeners
This commit is contained in:
parent
cc42d787d4
commit
984fca4726
5 changed files with 29 additions and 0 deletions
|
@ -17,6 +17,10 @@ func SetTfo(open bool) {
|
||||||
lc.DisableTFO = !open
|
lc.DisableTFO = !open
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetMPTCP(open bool) {
|
||||||
|
setMultiPathTCP(&lc.ListenConfig, open)
|
||||||
|
}
|
||||||
|
|
||||||
func ListenContext(ctx context.Context, network, address string) (net.Listener, error) {
|
func ListenContext(ctx context.Context, network, address string) (net.Listener, error) {
|
||||||
return lc.Listen(ctx, network, address)
|
return lc.Listen(ctx, network, address)
|
||||||
}
|
}
|
||||||
|
|
10
adapter/inbound/mptcp_go120.go
Normal file
10
adapter/inbound/mptcp_go120.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
//go:build !go1.21
|
||||||
|
|
||||||
|
package inbound
|
||||||
|
|
||||||
|
import "net"
|
||||||
|
|
||||||
|
const multipathTCPAvailable = false
|
||||||
|
|
||||||
|
func setMultiPathTCP(listenConfig *net.ListenConfig, open bool) {
|
||||||
|
}
|
11
adapter/inbound/mptcp_go121.go
Normal file
11
adapter/inbound/mptcp_go121.go
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
//go:build go1.21
|
||||||
|
|
||||||
|
package inbound
|
||||||
|
|
||||||
|
import "net"
|
||||||
|
|
||||||
|
const multipathTCPAvailable = true
|
||||||
|
|
||||||
|
func setMultiPathTCP(listenConfig *net.ListenConfig, open bool) {
|
||||||
|
listenConfig.SetMultipathTCP(open)
|
||||||
|
}
|
|
@ -76,6 +76,7 @@ type Inbound struct {
|
||||||
AllowLan bool `json:"allow-lan"`
|
AllowLan bool `json:"allow-lan"`
|
||||||
BindAddress string `json:"bind-address"`
|
BindAddress string `json:"bind-address"`
|
||||||
InboundTfo bool `json:"inbound-tfo"`
|
InboundTfo bool `json:"inbound-tfo"`
|
||||||
|
InboundMPTCP bool `json:"inbound-mptcp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controller config
|
// Controller config
|
||||||
|
@ -243,6 +244,7 @@ type RawConfig struct {
|
||||||
ShadowSocksConfig string `yaml:"ss-config"`
|
ShadowSocksConfig string `yaml:"ss-config"`
|
||||||
VmessConfig string `yaml:"vmess-config"`
|
VmessConfig string `yaml:"vmess-config"`
|
||||||
InboundTfo bool `yaml:"inbound-tfo"`
|
InboundTfo bool `yaml:"inbound-tfo"`
|
||||||
|
InboundMPTCP bool `yaml:"inbound-mptcp"`
|
||||||
Authentication []string `yaml:"authentication"`
|
Authentication []string `yaml:"authentication"`
|
||||||
AllowLan bool `yaml:"allow-lan"`
|
AllowLan bool `yaml:"allow-lan"`
|
||||||
BindAddress string `yaml:"bind-address"`
|
BindAddress string `yaml:"bind-address"`
|
||||||
|
@ -557,6 +559,7 @@ func parseGeneral(cfg *RawConfig) (*General, error) {
|
||||||
AllowLan: cfg.AllowLan,
|
AllowLan: cfg.AllowLan,
|
||||||
BindAddress: cfg.BindAddress,
|
BindAddress: cfg.BindAddress,
|
||||||
InboundTfo: cfg.InboundTfo,
|
InboundTfo: cfg.InboundTfo,
|
||||||
|
InboundMPTCP: cfg.InboundMPTCP,
|
||||||
},
|
},
|
||||||
Controller: Controller{
|
Controller: Controller{
|
||||||
ExternalController: cfg.ExternalController,
|
ExternalController: cfg.ExternalController,
|
||||||
|
|
|
@ -360,6 +360,7 @@ func updateGeneral(general *config.General) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inbound.SetTfo(general.InboundTfo)
|
inbound.SetTfo(general.InboundTfo)
|
||||||
|
inbound.SetMPTCP(general.InboundMPTCP)
|
||||||
|
|
||||||
adapter.UnifiedDelay.Store(general.UnifiedDelay)
|
adapter.UnifiedDelay.Store(general.UnifiedDelay)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue