@@ -15,29 +15,54 @@ func Test_networkServerErrorLogWriter_shouldDiscard(t *testing.T) {
15
15
want string
16
16
}{
17
17
{
18
- name : "ipv4 trusted proxy" ,
18
+ name : "ipv4 trusted proxy (write) " ,
19
19
proxies : []net.IP {net .ParseIP ("10.24.0.32" )},
20
20
log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from 10.24.0.32:55672: write tcp 10.24.0.22:8443->10.24.0.32:55672: write: connection reset by peer\n " ),
21
21
want : "" ,
22
22
},
23
23
{
24
- name : "ipv4 non-trusted proxy" ,
24
+ name : "ipv4 non-trusted proxy (write) " ,
25
25
proxies : []net.IP {net .ParseIP ("10.24.0.33" )},
26
26
log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from 10.24.0.32:55672: write tcp 10.24.0.22:8443->10.24.0.32:55672: write: connection reset by peer\n " ),
27
27
want : "http: TLS handshake error from 10.24.0.32:55672: write tcp 10.24.0.22:8443->10.24.0.32:55672: write: connection reset by peer" ,
28
28
},
29
29
{
30
- name : "ipv6 trusted proxy" ,
30
+ name : "ipv6 trusted proxy (write) " ,
31
31
proxies : []net.IP {net .ParseIP ("2602:fd23:8:1003:216:3eff:fefa:7670" )},
32
32
log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write: connection reset by peer\n " ),
33
33
want : "" ,
34
34
},
35
35
{
36
- name : "ipv6 non-trusted proxy" ,
36
+ name : "ipv6 non-trusted proxy (write) " ,
37
37
proxies : []net.IP {net .ParseIP ("2602:fd23:8:1003:216:3eff:fefa:7671" )},
38
38
log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write: connection reset by peer\n " ),
39
39
want : "http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: write: connection reset by peer" ,
40
40
},
41
+ {
42
+ name : "ipv4 trusted proxy (read)" ,
43
+ proxies : []net.IP {net .ParseIP ("10.24.0.32" )},
44
+ log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from 10.24.0.32:55672: read tcp 10.24.0.22:8443->10.24.0.32:55672: read: connection reset by peer\n " ),
45
+ want : "" ,
46
+ },
47
+ {
48
+ name : "ipv4 non-trusted proxy (read)" ,
49
+ proxies : []net.IP {net .ParseIP ("10.24.0.33" )},
50
+ log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from 10.24.0.32:55672: read tcp 10.24.0.22:8443->10.24.0.32:55672: read: connection reset by peer\n " ),
51
+ want : "http: TLS handshake error from 10.24.0.32:55672: read tcp 10.24.0.22:8443->10.24.0.32:55672: read: connection reset by peer" ,
52
+ },
53
+ {
54
+ name : "ipv6 trusted proxy (read)" ,
55
+ proxies : []net.IP {net .ParseIP ("2602:fd23:8:1003:216:3eff:fefa:7670" )},
56
+ log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read: connection reset by peer\n " ),
57
+ want : "" ,
58
+ },
59
+ {
60
+ name : "ipv6 non-trusted proxy (read)" ,
61
+ proxies : []net.IP {net .ParseIP ("2602:fd23:8:1003:216:3eff:fefa:7671" )},
62
+ log : []byte ("Sep 17 04:58:30 abydos incus.daemon[21884]: 2021/09/17 04:58:30 http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read: connection reset by peer\n " ),
63
+ want : "http: TLS handshake error from [2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read tcp [2602:fd23:8:101::100]:8443->[2602:fd23:8:1003:216:3eff:fefa:7670]:55672: read: connection reset by peer" ,
64
+ },
65
+
41
66
{
42
67
name : "unrelated" ,
43
68
proxies : []net.IP {},
0 commit comments