Skip to content
Commits on Source (4)
== v1.6.0
Fixed a type assertion panic in DialOr that occurred when the network dial
failed. Patch by Rob Jansen.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues/2
Enhanced the TestGetServerBindaddrs test to compare not only MethodName and
Addr, but also Options, and fixed a test case that expected the wrong Options.
Patch by Jack Wampler.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/merge_requests/2
== v1.5.0
Added the ReportVersion function that lets a client or server report its
implementation version using the new STATUS TYPE=version feature.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib/-/issues/1
== v1.4.0
......
......@@ -1045,5 +1045,8 @@ func DialOrWithDialer(dialer *net.Dialer, info *ServerInfo, addr, methodName str
// sent.
func DialOr(info *ServerInfo, addr, methodName string) (*net.TCPConn, error) {
c, err := DialOrWithDialer(&net.Dialer{}, info, addr, methodName)
return c.(*net.TCPConn), err
if err != nil {
return nil, err
}
return c.(*net.TCPConn), nil
}
......@@ -275,7 +275,7 @@ func TestResolveAddr(t *testing.T) {
func bindaddrSliceContains(s []Bindaddr, v Bindaddr) bool {
for _, sv := range s {
if sv.MethodName == v.MethodName && tcpAddrsEqual(sv.Addr, v.Addr) {
if sv.MethodName == v.MethodName && tcpAddrsEqual(sv.Addr, v.Addr) && argsEqual(sv.Options, v.Options) {
return true
}
}
......@@ -354,12 +354,21 @@ func TestGetServerBindaddrs(t *testing.T) {
{
"alpha-1.2.3.4:1111,beta-[1:2::3:4]:2222",
"alpha,beta,gamma",
"alpha:k1=v1,beta:k2=v2,gamma:k3=v3",
"alpha:k1=v1;beta:k2=v2;gamma:k3=v3",
[]Bindaddr{
{"alpha", &net.TCPAddr{IP: net.ParseIP("1.2.3.4"), Port: 1111}, Args{"k1": []string{"v1"}}},
{"beta", &net.TCPAddr{IP: net.ParseIP("1:2::3:4"), Port: 2222}, Args{"k2": []string{"v2"}}},
},
},
{
"alpha-1.2.3.4:1111,beta-[1:2::3:4]:2222",
"alpha,beta,gamma",
"alpha:k1=v1,beta:k2=v2,gamma:k3=v3",
[]Bindaddr{
{"alpha", &net.TCPAddr{IP: net.ParseIP("1.2.3.4"), Port: 1111}, Args{"k1": []string{"v1,beta:k2=v2,gamma:k3=v3"}}},
{"beta", &net.TCPAddr{IP: net.ParseIP("1:2::3:4"), Port: 2222}, Args{}},
},
},
{
"alpha-1.2.3.4:1111",
"xxx",
......