mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
p2p/server: fix stun test
This commit is contained in:
parent
ea8e272e1a
commit
e02e3abea9
2 changed files with 5 additions and 5 deletions
|
|
@ -69,10 +69,10 @@ func TestAutoDiscRace(t *testing.T) {
|
||||||
func TestParseStun(t *testing.T) {
|
func TestParseStun(t *testing.T) {
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
natStr string
|
natStr string
|
||||||
want *stun
|
want STUN
|
||||||
}{
|
}{
|
||||||
{"stun", &stun{serverList: strings.Split(stunDefaultServers, "\n")}},
|
{"stun", STUN{stun: stun{serverList: strings.Split(stunDefaultServers, "\n")}}},
|
||||||
{"stun:1.2.3.4:1234", &stun{serverList: []string{"1.2.3.4:1234"}}},
|
{"stun:1.2.3.4:1234", STUN{stun: stun{serverList: []string{"1.2.3.4:1234"}}}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testcases {
|
for _, tc := range testcases {
|
||||||
|
|
@ -80,7 +80,7 @@ func TestParseStun(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("should no err, but get %v", err)
|
t.Errorf("should no err, but get %v", err)
|
||||||
}
|
}
|
||||||
stun := nat.(*stun)
|
stun := nat.(STUN)
|
||||||
assert.Equal(t, stun.serverList, tc.want.serverList)
|
assert.Equal(t, stun.serverList, tc.want.serverList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ func newSTUN(serverAddr string) (Interface, error) {
|
||||||
}
|
}
|
||||||
s.serverList = []string{serverAddr}
|
s.serverList = []string{serverAddr}
|
||||||
}
|
}
|
||||||
return s, nil
|
return STUN{stun: *s}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s stun) String() string {
|
func (s stun) String() string {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue