mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-09 14:10:00 +00:00
parent
d7bda39f9e
commit
476e045451
@ -46,6 +46,7 @@ type serverConfig struct {
|
||||
ReceiveWindowClient uint64 `json:"recv_window_client"`
|
||||
MaxConnClient int `json:"max_conn_client"`
|
||||
DisableMTUDiscovery bool `json:"disable_mtu_discovery"`
|
||||
IPv6Only bool `json:"ipv6_only"`
|
||||
}
|
||||
|
||||
func (c *serverConfig) Check() error {
|
||||
|
@ -128,6 +128,10 @@ func server(config *serverConfig) {
|
||||
if len(config.Obfs) > 0 {
|
||||
obfuscator = obfs.NewXPlusObfuscator([]byte(config.Obfs))
|
||||
}
|
||||
// IPv6 only mode
|
||||
if config.IPv6Only {
|
||||
transport.DefaultTransport = transport.IPv6OnlyTransport
|
||||
}
|
||||
// ACL
|
||||
var aclEngine *acl.Engine
|
||||
if len(config.ACL) > 0 {
|
||||
|
@ -22,6 +22,12 @@ var DefaultTransport Transport = &defaultTransport{
|
||||
Timeout: 8 * time.Second,
|
||||
}
|
||||
|
||||
var IPv6OnlyTransport Transport = &ipv6OnlyTransport{
|
||||
defaultTransport{
|
||||
Timeout: 8 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
type defaultTransport struct {
|
||||
Timeout time.Duration
|
||||
}
|
||||
@ -67,3 +73,11 @@ func (t *defaultTransport) LocalListenTCP(laddr *net.TCPAddr) (*net.TCPListener,
|
||||
func (t *defaultTransport) LocalListenUDP(laddr *net.UDPAddr) (*net.UDPConn, error) {
|
||||
return net.ListenUDP("udp", laddr)
|
||||
}
|
||||
|
||||
type ipv6OnlyTransport struct {
|
||||
defaultTransport
|
||||
}
|
||||
|
||||
func (t *ipv6OnlyTransport) LocalResolveIPAddr(address string) (*net.IPAddr, error) {
|
||||
return net.ResolveIPAddr("ip6", address)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user