$29 GRAYBYTE WORDPRESS FILE MANAGER $88

SERVER : in-mum-web1330.main-hosting.eu #1 SMP Mon Feb 10 22:45:17 UTC 2025
SERVER IP : 93.127.173.63 | ADMIN IP 216.73.216.215
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/go/pkg/mod/github.com/hashicorp/memberlist@v0.5.0/

HOME
Current File : /opt/go/pkg/mod/github.com/hashicorp/memberlist@v0.5.0//config_test.go
package memberlist

import (
	"net"
	"testing"
)

func Test_IsValidAddressDefaults(t *testing.T) {
	tests := []string{
		"127.0.0.1",
		"127.0.0.5",
		"10.0.0.9",
		"172.16.0.7",
		"192.168.2.1",
		"fe80::aede:48ff:fe00:1122",
		"::1",
	}
	config := DefaultLANConfig()
	for _, ip := range tests {
		localV4 := net.ParseIP(ip)
		if err := config.IPAllowed(localV4); err != nil {
			t.Fatalf("IP %s Localhost Should be accepted for LAN", ip)
		}
	}
	config = DefaultWANConfig()
	for _, ip := range tests {
		localV4 := net.ParseIP(ip)
		if err := config.IPAllowed(localV4); err != nil {
			t.Fatalf("IP %s Localhost Should be accepted for WAN", ip)
		}
	}
}

func Test_IsValidAddressOverride(t *testing.T) {
	t.Parallel()
	cases := []struct {
		name    string
		allow   []string
		success []string
		fail    []string
	}{
		{
			name:    "Default, nil allows all",
			allow:   nil,
			success: []string{"127.0.0.5", "10.0.0.9", "192.168.1.7", "::1"},
			fail:    []string{},
		},
		{
			name:    "Only IPv4",
			allow:   []string{"0.0.0.0/0"},
			success: []string{"127.0.0.5", "10.0.0.9", "192.168.1.7"},
			fail:    []string{"fe80::38bc:4dff:fe62:b1ae", "::1"},
		},
		{
			name:    "Only IPv6",
			allow:   []string{"::0/0"},
			success: []string{"fe80::38bc:4dff:fe62:b1ae", "::1"},
			fail:    []string{"127.0.0.5", "10.0.0.9", "192.168.1.7"},
		},
		{
			name:    "Only 127.0.0.0/8 and ::1",
			allow:   []string{"::1/128", "127.0.0.0/8"},
			success: []string{"127.0.0.5", "::1"},
			fail:    []string{"::2", "178.250.0.187", "10.0.0.9", "192.168.1.7", "fe80::38bc:4dff:fe62:b1ae"},
		},
	}

	for _, testCase := range cases {
		t.Run(testCase.name, func(t *testing.T) {
			config := DefaultLANConfig()
			var err error
			config.CIDRsAllowed, err = ParseCIDRs(testCase.allow)
			if err != nil {
				t.Fatalf("failed parsing %s", testCase.allow)
			}
			for _, ips := range testCase.success {
				ip := net.ParseIP(ips)
				if err := config.IPAllowed(ip); err != nil {
					t.Fatalf("Test case with %s should pass", ip)
				}
			}
			for _, ips := range testCase.fail {
				ip := net.ParseIP(ips)
				if err := config.IPAllowed(ip); err == nil {
					t.Fatalf("Test case with %s should fail", ip)
				}
			}
		})

	}

}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 Jan 2024 4.43 PM
root / root
0755
.github
--
25 Jan 2024 4.43 PM
root / root
0555
internal
--
25 Jan 2024 4.43 PM
root / root
0555
test
--
25 Jan 2024 4.43 PM
root / root
0555
.gitignore
0.264 KB
25 Jan 2024 4.43 PM
root / root
0444
.golangci.yml
2.646 KB
25 Jan 2024 4.43 PM
root / root
0444
LICENSE
15.603 KB
25 Jan 2024 4.43 PM
root / root
0444
Makefile
0.654 KB
25 Jan 2024 4.43 PM
root / root
0444
README.md
3.12 KB
25 Jan 2024 4.43 PM
root / root
0444
alive_delegate.go
0.577 KB
25 Jan 2024 4.43 PM
root / root
0444
awareness.go
1.9 KB
25 Jan 2024 4.43 PM
root / root
0444
awareness_test.go
0.915 KB
25 Jan 2024 4.43 PM
root / root
0444
broadcast.go
3.233 KB
25 Jan 2024 4.43 PM
root / root
0444
broadcast_test.go
0.564 KB
25 Jan 2024 4.43 PM
root / root
0444
config.go
15.32 KB
25 Jan 2024 4.43 PM
root / root
0444
config_test.go
2.171 KB
25 Jan 2024 4.43 PM
root / root
0444
conflict_delegate.go
0.367 KB
25 Jan 2024 4.43 PM
root / root
0444
delegate.go
1.808 KB
25 Jan 2024 4.43 PM
root / root
0444
event_delegate.go
1.873 KB
25 Jan 2024 4.43 PM
root / root
0444
go.mod
0.714 KB
25 Jan 2024 4.43 PM
root / root
0444
go.sum
4.714 KB
25 Jan 2024 4.43 PM
root / root
0444
integ_test.go
1.972 KB
25 Jan 2024 4.43 PM
root / root
0444
keyring.go
4.399 KB
25 Jan 2024 4.43 PM
root / root
0444
keyring_test.go
3.626 KB
25 Jan 2024 4.43 PM
root / root
0444
label.go
4.724 KB
25 Jan 2024 4.43 PM
root / root
0444
label_test.go
9.289 KB
25 Jan 2024 4.43 PM
root / root
0444
logging.go
0.443 KB
25 Jan 2024 4.43 PM
root / root
0444
logging_test.go
0.782 KB
25 Jan 2024 4.43 PM
root / root
0444
memberlist.go
22.886 KB
25 Jan 2024 4.43 PM
root / root
0444
memberlist_test.go
49.766 KB
25 Jan 2024 4.43 PM
root / root
0444
merge_delegate.go
0.557 KB
25 Jan 2024 4.43 PM
root / root
0444
mock_transport.go
4.287 KB
25 Jan 2024 4.43 PM
root / root
0444
net.go
38.072 KB
25 Jan 2024 4.43 PM
root / root
0444
net_test.go
20.005 KB
25 Jan 2024 4.43 PM
root / root
0444
net_transport.go
10.031 KB
25 Jan 2024 4.43 PM
root / root
0444
peeked_conn.go
1.558 KB
25 Jan 2024 4.43 PM
root / root
0444
ping_delegate.go
0.63 KB
25 Jan 2024 4.43 PM
root / root
0444
queue.go
11.117 KB
25 Jan 2024 4.43 PM
root / root
0444
queue_test.go
6.806 KB
25 Jan 2024 4.43 PM
root / root
0444
security.go
5.315 KB
25 Jan 2024 4.43 PM
root / root
0444
security_test.go
1.474 KB
25 Jan 2024 4.43 PM
root / root
0444
state.go
37.886 KB
25 Jan 2024 4.43 PM
root / root
0444
state_test.go
62.422 KB
25 Jan 2024 4.43 PM
root / root
0444
suspicion.go
4.197 KB
25 Jan 2024 4.43 PM
root / root
0444
suspicion_test.go
4.392 KB
25 Jan 2024 4.43 PM
root / root
0444
tag.sh
0.39 KB
25 Jan 2024 4.43 PM
root / root
0444
todo.md
0.206 KB
25 Jan 2024 4.43 PM
root / root
0444
transport.go
5.372 KB
25 Jan 2024 4.43 PM
root / root
0444
transport_test.go
5.192 KB
25 Jan 2024 4.43 PM
root / root
0444
util.go
8.501 KB
25 Jan 2024 4.43 PM
root / root
0444
util_test.go
8.381 KB
25 Jan 2024 4.43 PM
root / root
0444

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF