mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-09-10 21:34:07 +08:00
documentation: Add notes for hysteria2 compatibility issues
This commit is contained in:
parent
70bff53cea
commit
b3f9509810
@ -25,6 +25,10 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! warning "Compatibility issues with original client"
|
||||||
|
|
||||||
|
When using the original client, the use case with `fastOpen=false` or UDP MTU >= 1200 is not supported.
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
QUIC, which is required by Hysteria2 is not included by default, see [Installation](/#installation).
|
QUIC, which is required by Hysteria2 is not included by default, see [Installation](/#installation).
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! warning "与原始客户端的兼容性问题"
|
||||||
|
|
||||||
|
当使用原始客户端时,不支持 `fastOpen=false` 或者 UDP MTU >= 1200 的用例。
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
默认安装不包含被 Hysteria2 依赖的 QUIC,参阅 [安装](/zh/#_2)。
|
默认安装不包含被 Hysteria2 依赖的 QUIC,参阅 [安装](/zh/#_2)。
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! warning "Compatibility issues with original server"
|
||||||
|
|
||||||
|
When using the original server, the use case with `fastOpen=false` or UDP MTU >= 1200 is not supported.
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
QUIC, which is required by Hysteria2 is not included by default, see [Installation](/#installation).
|
QUIC, which is required by Hysteria2 is not included by default, see [Installation](/#installation).
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
!!! warning "与原始服务器的兼容性问题"
|
||||||
|
|
||||||
|
当使用原始服务器时,不支持 `fastOpen=false` 或者 UDP MTU >= 1200 的用例。
|
||||||
|
|
||||||
!!! warning ""
|
!!! warning ""
|
||||||
|
|
||||||
默认安装不包含被 Hysteria2 依赖的 QUIC,参阅 [安装](/zh/#_2)。
|
默认安装不包含被 Hysteria2 依赖的 QUIC,参阅 [安装](/zh/#_2)。
|
||||||
|
@ -32,7 +32,8 @@ const (
|
|||||||
ImageTrojan = "trojangfw/trojan:latest"
|
ImageTrojan = "trojangfw/trojan:latest"
|
||||||
ImageNaive = "pocat/naiveproxy:client"
|
ImageNaive = "pocat/naiveproxy:client"
|
||||||
ImageBoringTun = "ghcr.io/ntkme/boringtun:edge"
|
ImageBoringTun = "ghcr.io/ntkme/boringtun:edge"
|
||||||
ImageHysteria = "tobyxdd/hysteria:latest"
|
ImageHysteria = "teddysun/hysteria:1.3.5"
|
||||||
|
ImageHysteria2 = "teddysun/hysteria:latest"
|
||||||
ImageNginx = "nginx:stable"
|
ImageNginx = "nginx:stable"
|
||||||
ImageShadowTLS = "ghcr.io/ihciah/shadow-tls:latest"
|
ImageShadowTLS = "ghcr.io/ihciah/shadow-tls:latest"
|
||||||
ImageShadowsocksR = "teddysun/shadowsocks-r:latest"
|
ImageShadowsocksR = "teddysun/shadowsocks-r:latest"
|
||||||
@ -50,6 +51,7 @@ var allImages = []string{
|
|||||||
ImageNaive,
|
ImageNaive,
|
||||||
ImageBoringTun,
|
ImageBoringTun,
|
||||||
ImageHysteria,
|
ImageHysteria,
|
||||||
|
ImageHysteria2,
|
||||||
ImageNginx,
|
ImageNginx,
|
||||||
ImageShadowTLS,
|
ImageShadowTLS,
|
||||||
ImageShadowsocksR,
|
ImageShadowsocksR,
|
||||||
@ -376,7 +378,7 @@ func testLargeDataWithPacketConnSize(t *testing.T, port uint16, chunkSize int, p
|
|||||||
|
|
||||||
rAddr := &net.UDPAddr{IP: localIP.AsSlice(), Port: int(port)}
|
rAddr := &net.UDPAddr{IP: localIP.AsSlice(), Port: int(port)}
|
||||||
|
|
||||||
times := 50
|
times := 2
|
||||||
|
|
||||||
pingCh, pongCh, test := newLargeDataPair()
|
pingCh, pongCh, test := newLargeDataPair()
|
||||||
writeRandData := func(pc net.PacketConn, addr net.Addr) (map[int][]byte, error) {
|
writeRandData := func(pc net.PacketConn, addr net.Addr) (map[int][]byte, error) {
|
||||||
|
12
test/config/hysteria2-client.yml
Normal file
12
test/config/hysteria2-client.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
server: 127.0.0.1:10000
|
||||||
|
auth: password
|
||||||
|
fastOpen: true
|
||||||
|
socks5:
|
||||||
|
listen: 127.0.0.1:10001
|
||||||
|
tls:
|
||||||
|
sni: example.org
|
||||||
|
ca: /etc/hysteria/ca.pem
|
||||||
|
obfs:
|
||||||
|
type: salamander
|
||||||
|
salamander:
|
||||||
|
password: cry_me_a_r1ver
|
13
test/config/hysteria2-server.yml
Normal file
13
test/config/hysteria2-server.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
listen: 127.0.0.1:10000
|
||||||
|
auth:
|
||||||
|
type: password
|
||||||
|
password: password
|
||||||
|
fastOpen: true
|
||||||
|
tls:
|
||||||
|
sni: example.org
|
||||||
|
cert: /etc/hysteria/cert.pem
|
||||||
|
key: /etc/hysteria/key.pem
|
||||||
|
obfs:
|
||||||
|
type: salamander
|
||||||
|
salamander:
|
||||||
|
password: cry_me_a_r1ver
|
@ -95,3 +95,92 @@ func testHysteria2Self(t *testing.T, salamanderPassword string) {
|
|||||||
})
|
})
|
||||||
testSuit(t, clientPort, testPort)
|
testSuit(t, clientPort, testPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestHysteria2Inbound(t *testing.T) {
|
||||||
|
caPem, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
||||||
|
startInstance(t, option.Options{
|
||||||
|
Inbounds: []option.Inbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeHysteria2,
|
||||||
|
Hysteria2Options: option.Hysteria2InboundOptions{
|
||||||
|
ListenOptions: option.ListenOptions{
|
||||||
|
Listen: option.NewListenAddress(netip.IPv4Unspecified()),
|
||||||
|
ListenPort: serverPort,
|
||||||
|
},
|
||||||
|
Obfs: &option.Hysteria2Obfs{
|
||||||
|
Type: hysteria2.ObfsTypeSalamander,
|
||||||
|
Password: "cry_me_a_r1ver",
|
||||||
|
},
|
||||||
|
Users: []option.Hysteria2User{{
|
||||||
|
Password: "password",
|
||||||
|
}},
|
||||||
|
TLS: &option.InboundTLSOptions{
|
||||||
|
Enabled: true,
|
||||||
|
ServerName: "example.org",
|
||||||
|
CertificatePath: certPem,
|
||||||
|
KeyPath: keyPem,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
startDockerContainer(t, DockerOptions{
|
||||||
|
Image: ImageHysteria2,
|
||||||
|
Ports: []uint16{serverPort, clientPort},
|
||||||
|
Cmd: []string{"hysteria", "client", "-c", "/etc/hysteria/config.yml", "--disable-update-check", "--log-level", "debug"},
|
||||||
|
Bind: map[string]string{
|
||||||
|
"hysteria2-client.yml": "/etc/hysteria/config.yml",
|
||||||
|
caPem: "/etc/hysteria/ca.pem",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
testSuit(t, clientPort, testPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestHysteria2Outbound(t *testing.T) {
|
||||||
|
_, certPem, keyPem := createSelfSignedCertificate(t, "example.org")
|
||||||
|
startDockerContainer(t, DockerOptions{
|
||||||
|
Image: ImageHysteria2,
|
||||||
|
Ports: []uint16{testPort},
|
||||||
|
Cmd: []string{"hysteria", "server", "-c", "/etc/hysteria/config.yml", "--disable-update-check", "--log-level", "debug"},
|
||||||
|
Bind: map[string]string{
|
||||||
|
"hysteria2-server.yml": "/etc/hysteria/config.yml",
|
||||||
|
certPem: "/etc/hysteria/cert.pem",
|
||||||
|
keyPem: "/etc/hysteria/key.pem",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
startInstance(t, option.Options{
|
||||||
|
Inbounds: []option.Inbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeMixed,
|
||||||
|
MixedOptions: option.HTTPMixedInboundOptions{
|
||||||
|
ListenOptions: option.ListenOptions{
|
||||||
|
Listen: option.NewListenAddress(netip.IPv4Unspecified()),
|
||||||
|
ListenPort: clientPort,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Outbounds: []option.Outbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeHysteria2,
|
||||||
|
Hysteria2Options: option.Hysteria2OutboundOptions{
|
||||||
|
ServerOptions: option.ServerOptions{
|
||||||
|
Server: "127.0.0.1",
|
||||||
|
ServerPort: serverPort,
|
||||||
|
},
|
||||||
|
Obfs: &option.Hysteria2Obfs{
|
||||||
|
Type: hysteria2.ObfsTypeSalamander,
|
||||||
|
Password: "cry_me_a_r1ver",
|
||||||
|
},
|
||||||
|
Password: "password",
|
||||||
|
TLS: &option.OutboundTLSOptions{
|
||||||
|
Enabled: true,
|
||||||
|
ServerName: "example.org",
|
||||||
|
CertificatePath: certPem,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
testSuitSimple1(t, clientPort, testPort)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user