Skip to content
GitLab
Explore
Sign in
Commits on Source (4)
fix incorrect testcase for server bindaddr parsing
· 3c3a65bc
jmwample
authored
Mar 21, 2024
3c3a65bc
Do the type conversion only if is not nil
· 5d1fb9b6
meskio
authored
Nov 13, 2024
* Code from: Rob Jansen * Closes:
#2
5d1fb9b6
Use a more standard `err != nil` style in DialOr.
· 8f8090ae
David Fifield
authored
Nov 14, 2024
8f8090ae
v1.6.0
· f4bb5dd5
David Fifield
authored
Nov 14, 2024
f4bb5dd5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
f4bb5dd5
== 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
...
...
pt.go
View file @
f4bb5dd5
...
...
@@ -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
}
pt_test.go
View file @
f4bb5dd5
...
...
@@ -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"
,
...
...