feat: add test for sockopts config fields

This commit is contained in:
Toby 2024-04-05 16:15:29 -07:00
parent e6da1f348c
commit 6b5486fc09
2 changed files with 21 additions and 4 deletions

View File

@ -46,6 +46,11 @@ func TestClientConfig(t *testing.T) {
MaxIdleTimeout: 10 * time.Second, MaxIdleTimeout: 10 * time.Second,
KeepAlivePeriod: 4 * time.Second, KeepAlivePeriod: 4 * time.Second,
DisablePathMTUDiscovery: true, DisablePathMTUDiscovery: true,
Sockopts: clientConfigQUICSockopts{
BindInterface: stringRef("eth0"),
FirewallMark: uint32Ref(1234),
FdControlUnixSocket: stringRef("test.sock"),
},
}, },
Bandwidth: clientConfigBandwidth{ Bandwidth: clientConfigBandwidth{
Up: "200 mbps", Up: "200 mbps",
@ -189,3 +194,11 @@ func TestClientConfigURI(t *testing.T) {
}) })
} }
} }
func stringRef(s string) *string {
return &s
}
func uint32Ref(i uint32) *uint32 {
return &i
}

View File

@ -26,6 +26,10 @@ quic:
maxIdleTimeout: 10s maxIdleTimeout: 10s
keepAlivePeriod: 4s keepAlivePeriod: 4s
disablePathMTUDiscovery: true disablePathMTUDiscovery: true
sockopts:
bindInterface: eth0
fwmark: 1234
fdControlUnixSocket: test.sock
bandwidth: bandwidth:
up: 200 mbps up: 200 mbps
@ -75,7 +79,7 @@ tun:
ipv6: 2001::ffff:ffff:ffff:fff1/126 ipv6: 2001::ffff:ffff:ffff:fff1/126
route: route:
strict: true strict: true
ipv4: [0.0.0.0/0] ipv4: [ 0.0.0.0/0 ]
ipv6: ["2000::/3"] ipv6: [ "2000::/3" ]
ipv4Exclude: [192.0.2.1/32] ipv4Exclude: [ 192.0.2.1/32 ]
ipv6Exclude: ["2001:db8::1/128"] ipv6Exclude: [ "2001:db8::1/128" ]