File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 6
6
"errors"
7
7
"fmt"
8
8
"io/ioutil"
9
+ "net"
9
10
"net/http"
10
11
"net/http/httptest"
11
12
"reflect"
@@ -730,8 +731,24 @@ var listenerNetworkTests = []struct {
730
731
{"tcp6 ipv6 address" , "tcp6" , "[::1]:1323" },
731
732
}
732
733
734
+ func supportsIPv6 () bool {
735
+ addrs , _ := net .InterfaceAddrs ()
736
+ for _ , addr := range addrs {
737
+ // Check if any interface has local IPv6 assigned
738
+ if strings .Contains (addr .String (), "::1" ) {
739
+ return true
740
+ }
741
+ }
742
+ return false
743
+ }
744
+
733
745
func TestEchoListenerNetwork (t * testing.T ) {
746
+ hasIPv6 := supportsIPv6 ()
734
747
for _ , tt := range listenerNetworkTests {
748
+ if ! hasIPv6 && strings .Contains (tt .address , "::" ) {
749
+ t .Skip ("Skipping testing IPv6 for " + tt .address + ", not available" )
750
+ continue
751
+ }
735
752
t .Run (tt .test , func (t * testing.T ) {
736
753
e := New ()
737
754
e .ListenerNetwork = tt .network
You can’t perform that action at this time.
0 commit comments