@@ -18,19 +18,19 @@ func TestPeerConfig_String(t *testing.T) {
1818 {
1919 name : "empty PeerConfig" ,
2020 config : PeerConfig {},
21- expected : "PeerConfig{}" ,
21+ expected : "PeerConfig{Port: 0 }" ,
2222 },
2323 {
2424 name : "LocalIP" ,
2525 config : PeerConfig {
2626 LocalIP : testutils .ValToPtr ("192.168.1.1" ),
2727 },
28- expected : "PeerConfig{LocalIP: 192.168.1.1}" ,
28+ expected : "PeerConfig{Port: 0, LocalIP: 192.168.1.1}" ,
2929 },
3030 {
3131 name : "Port" ,
3232 config : PeerConfig {
33- Port : testutils . ValToPtr ( uint32 ( 179 )) ,
33+ Port : 179 ,
3434 },
3535 expected : "PeerConfig{Port: 179}" ,
3636 },
@@ -39,39 +39,39 @@ func TestPeerConfig_String(t *testing.T) {
3939 config : PeerConfig {
4040 RemoteASN : testutils .ValToPtr (uint32 (65000 )),
4141 },
42- expected : "PeerConfig{RemoteASN: 65000}" ,
42+ expected : "PeerConfig{Port: 0, RemoteASN: 65000}" ,
4343 },
4444 {
4545 name : "RemoteIP" ,
4646 config : PeerConfig {
4747 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.1" )),
4848 },
49- expected : "PeerConfig{RemoteIP: 10.0.0.1}" ,
49+ expected : "PeerConfig{Port: 0, RemoteIP: 10.0.0.1}" ,
5050 },
5151 {
5252 name : "RemoteIP with IPv6" ,
5353 config : PeerConfig {
5454 RemoteIP : testutils .ValToPtr (net .ParseIP ("2001:db8::1" )),
5555 },
56- expected : "PeerConfig{RemoteIP: 2001:db8::1}" ,
56+ expected : "PeerConfig{Port: 0, RemoteIP: 2001:db8::1}" ,
5757 },
5858 {
5959 name : "Password - should not be printed" ,
6060 config : PeerConfig {
6161 Password : testutils .ValToPtr (utils .Base64String ("password" )),
6262 },
63- expected : "PeerConfig{}" ,
63+ expected : "PeerConfig{Port: 0 }" ,
6464 },
6565 {
6666 name : "all fields - Password should not be printed" ,
6767 config : PeerConfig {
6868 LocalIP : testutils .ValToPtr ("192.168.1.1" ),
6969 Password : testutils .ValToPtr (utils .Base64String ("password" )),
70- Port : testutils . ValToPtr ( uint32 ( 179 )) ,
70+ Port : 179 ,
7171 RemoteASN : testutils .ValToPtr (uint32 (65000 )),
7272 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.1" )),
7373 },
74- expected : "PeerConfig{LocalIP: 192.168.1.1, Port: 179 , RemoteASN: 65000, RemoteIP: 10.0.0.1}" ,
74+ expected : "PeerConfig{Port: 179, LocalIP: 192.168.1.1, RemoteASN: 65000, RemoteIP: 10.0.0.1}" ,
7575 },
7676 }
7777
@@ -100,12 +100,12 @@ func TestPeerConfigs_String(t *testing.T) {
100100 {
101101 LocalIP : testutils .ValToPtr ("192.168.1.1" ),
102102 Password : testutils .ValToPtr (utils .Base64String ("secret" )),
103- Port : testutils . ValToPtr ( uint32 ( 179 )) ,
103+ Port : 179 ,
104104 RemoteASN : testutils .ValToPtr (uint32 (65000 )),
105105 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.1" )),
106106 },
107107 },
108- expected : "PeerConfigs[PeerConfig{LocalIP: 192.168.1.1, Port: 179 , RemoteASN: 65000, RemoteIP: 10.0.0.1}]" ,
108+ expected : "PeerConfigs[PeerConfig{Port: 179, LocalIP: 192.168.1.1, RemoteASN: 65000, RemoteIP: 10.0.0.1}]" ,
109109 },
110110 {
111111 name : "multiple PeerConfigs - passwords should not be printed" ,
@@ -117,15 +117,15 @@ func TestPeerConfigs_String(t *testing.T) {
117117 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.1" )),
118118 },
119119 {
120- Port : testutils . ValToPtr ( uint32 ( 1790 )) ,
120+ Port : 179 ,
121121 RemoteASN : testutils .ValToPtr (uint32 (65001 )),
122122 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.2" )),
123123 },
124124 {
125125 RemoteIP : testutils .ValToPtr (net .ParseIP ("10.0.0.3" )),
126126 },
127127 },
128- expected : "PeerConfigs[PeerConfig{LocalIP: 192.168.1.1, RemoteASN: 65000, RemoteIP: 10.0.0.1},PeerConfig{Port: 1790 , RemoteASN: 65001, RemoteIP: 10.0.0.2},PeerConfig{RemoteIP: 10.0.0.3}]" ,
128+ expected : "PeerConfigs[PeerConfig{Port: 0, LocalIP: 192.168.1.1, RemoteASN: 65000, RemoteIP: 10.0.0.1},PeerConfig{Port: 179 , RemoteASN: 65001, RemoteIP: 10.0.0.2},PeerConfig{Port: 0, RemoteIP: 10.0.0.3}]" ,
129129 },
130130 }
131131
0 commit comments