X7ROOT File Manager
Current Path:
/opt/golang/1.22.0/src/net
opt
/
golang
/
1.22.0
/
src
/
net
/
π
..
π
addrselect.go
(9.69 KB)
π
addrselect_test.go
(8.5 KB)
π
cgo_aix.go
(582 B)
π
cgo_android.go
(272 B)
π
cgo_bsd.go
(343 B)
π
cgo_darwin.go
(298 B)
π
cgo_linux.go
(642 B)
π
cgo_netbsd.go
(276 B)
π
cgo_openbsd.go
(276 B)
π
cgo_resnew.go
(580 B)
π
cgo_resold.go
(579 B)
π
cgo_socknew.go
(753 B)
π
cgo_sockold.go
(842 B)
π
cgo_solaris.go
(343 B)
π
cgo_stub.go
(1.33 KB)
π
cgo_unix.go
(11.35 KB)
π
cgo_unix_cgo.go
(2.24 KB)
π
cgo_unix_cgo_darwin.go
(461 B)
π
cgo_unix_cgo_res.go
(911 B)
π
cgo_unix_cgo_resn.go
(998 B)
π
cgo_unix_syscall.go
(2.99 KB)
π
cgo_unix_test.go
(1.44 KB)
π
conf.go
(15.63 KB)
π
conf_test.go
(12.28 KB)
π
conn_test.go
(1.82 KB)
π
dial.go
(25.68 KB)
π
dial_test.go
(30.14 KB)
π
dial_unix_test.go
(2.77 KB)
π
dnsclient.go
(5.65 KB)
π
dnsclient_test.go
(1.51 KB)
π
dnsclient_unix.go
(24.26 KB)
π
dnsclient_unix_test.go
(69.13 KB)
π
dnsconfig.go
(1.73 KB)
π
dnsconfig_unix.go
(4.16 KB)
π
dnsconfig_unix_test.go
(7.07 KB)
π
dnsconfig_windows.go
(1.6 KB)
π
dnsname_test.go
(1.96 KB)
π
error_plan9.go
(224 B)
π
error_plan9_test.go
(437 B)
π
error_posix.go
(543 B)
π
error_posix_test.go
(981 B)
π
error_test.go
(20.32 KB)
π
error_unix.go
(382 B)
π
error_unix_test.go
(723 B)
π
error_windows.go
(355 B)
π
error_windows_test.go
(757 B)
π
example_test.go
(8.45 KB)
π
external_test.go
(4.05 KB)
π
fd_fake.go
(3.79 KB)
π
fd_js.go
(627 B)
π
fd_plan9.go
(3.56 KB)
π
fd_posix.go
(4.29 KB)
π
fd_unix.go
(5.43 KB)
π
fd_wasip1.go
(496 B)
π
fd_windows.go
(6.14 KB)
π
file.go
(1.69 KB)
π
file_plan9.go
(2.72 KB)
π
file_stub.go
(481 B)
π
file_test.go
(6.43 KB)
π
file_unix.go
(2.5 KB)
π
file_unix_test.go
(2.07 KB)
π
file_wasip1.go
(2.2 KB)
π
file_wasip1_test.go
(3.76 KB)
π
file_windows.go
(521 B)
π
hook.go
(894 B)
π
hook_plan9.go
(211 B)
π
hook_unix.go
(658 B)
π
hook_windows.go
(720 B)
π
hosts.go
(3.48 KB)
π
hosts_test.go
(5.6 KB)
π
http
π
interface.go
(7.26 KB)
π
interface_aix.go
(4.46 KB)
π
interface_bsd.go
(2.82 KB)
π
interface_bsd_test.go
(1.44 KB)
π
interface_bsdvar.go
(718 B)
π
interface_darwin.go
(1.29 KB)
π
interface_freebsd.go
(1.29 KB)
π
interface_linux.go
(6.96 KB)
π
interface_linux_test.go
(3.65 KB)
π
interface_plan9.go
(4.71 KB)
π
interface_solaris.go
(2.13 KB)
π
interface_stub.go
(814 B)
π
interface_test.go
(9.76 KB)
π
interface_unix_test.go
(4.85 KB)
π
interface_windows.go
(5.43 KB)
π
internal
π
ip.go
(13.88 KB)
π
ip_test.go
(25.6 KB)
π
iprawsock.go
(7.11 KB)
π
iprawsock_plan9.go
(874 B)
π
iprawsock_posix.go
(3.89 KB)
π
iprawsock_test.go
(5.98 KB)
π
ipsock.go
(9.05 KB)
π
ipsock_plan9.go
(7.48 KB)
π
ipsock_plan9_test.go
(645 B)
π
ipsock_posix.go
(7.86 KB)
π
ipsock_test.go
(6.81 KB)
π
listen_test.go
(20.5 KB)
π
lookup.go
(29.04 KB)
π
lookup_plan9.go
(9.94 KB)
π
lookup_test.go
(40.62 KB)
π
lookup_unix.go
(3.35 KB)
π
lookup_windows.go
(13.8 KB)
π
lookup_windows_test.go
(8.93 KB)
π
mac.go
(1.88 KB)
π
mac_test.go
(3.26 KB)
π
mail
π
main_cloexec_test.go
(693 B)
π
main_conf_test.go
(1.39 KB)
π
main_noconf_test.go
(467 B)
π
main_plan9_test.go
(392 B)
π
main_posix_test.go
(1.37 KB)
π
main_test.go
(7.53 KB)
π
main_unix_test.go
(1.19 KB)
π
main_wasm_test.go
(284 B)
π
main_windows_test.go
(1 KB)
π
mockserver_test.go
(10.77 KB)
π
mptcpsock_linux.go
(3.96 KB)
π
mptcpsock_linux_test.go
(4.06 KB)
π
mptcpsock_stub.go
(542 B)
π
net.go
(24.56 KB)
π
net_fake.go
(26.36 KB)
π
net_fake_test.go
(2.79 KB)
π
net_test.go
(14 KB)
π
net_windows_test.go
(16.28 KB)
π
netcgo_off.go
(222 B)
π
netcgo_on.go
(220 B)
π
netgo_netcgo.go
(453 B)
π
netgo_off.go
(220 B)
π
netgo_on.go
(218 B)
π
netip
π
nss.go
(5.48 KB)
π
nss_test.go
(3.4 KB)
π
packetconn_test.go
(3.02 KB)
π
parse.go
(6.04 KB)
π
parse_test.go
(1.55 KB)
π
pipe.go
(5.43 KB)
π
pipe_test.go
(1.2 KB)
π
platform_test.go
(4.33 KB)
π
port.go
(1.46 KB)
π
port_test.go
(1.34 KB)
π
port_unix.go
(1.24 KB)
π
protoconn_test.go
(7.44 KB)
π
rawconn.go
(2.7 KB)
π
rawconn_stub_test.go
(631 B)
π
rawconn_test.go
(4.33 KB)
π
rawconn_unix_test.go
(2.96 KB)
π
rawconn_windows_test.go
(3.12 KB)
π
resolverdialfunc_test.go
(8.25 KB)
π
rlimit_js.go
(346 B)
π
rlimit_unix.go
(1.1 KB)
π
rpc
π
sendfile_linux.go
(1.12 KB)
π
sendfile_linux_test.go
(1.93 KB)
π
sendfile_stub.go
(344 B)
π
sendfile_test.go
(8.25 KB)
π
sendfile_unix_alt.go
(2.04 KB)
π
sendfile_windows.go
(1.02 KB)
π
server_test.go
(11.67 KB)
π
smtp
π
sock_bsd.go
(918 B)
π
sock_cloexec.go
(1.38 KB)
π
sock_linux.go
(993 B)
π
sock_linux_test.go
(575 B)
π
sock_plan9.go
(262 B)
π
sock_posix.go
(6.29 KB)
π
sock_stub.go
(390 B)
π
sock_windows.go
(802 B)
π
sockaddr_posix.go
(1.45 KB)
π
sockopt_aix.go
(1.43 KB)
π
sockopt_bsd.go
(2.21 KB)
π
sockopt_fake.go
(955 B)
π
sockopt_linux.go
(1.25 KB)
π
sockopt_plan9.go
(406 B)
π
sockopt_posix.go
(2.13 KB)
π
sockopt_solaris.go
(1.25 KB)
π
sockopt_windows.go
(1.51 KB)
π
sockoptip_bsdvar.go
(867 B)
π
sockoptip_linux.go
(735 B)
π
sockoptip_posix.go
(1.38 KB)
π
sockoptip_stub.go
(769 B)
π
sockoptip_windows.go
(786 B)
π
splice_linux.go
(1.69 KB)
π
splice_stub.go
(376 B)
π
splice_test.go
(13.48 KB)
π
sys_cloexec.go
(962 B)
π
tcpsock.go
(11.75 KB)
π
tcpsock_plan9.go
(2.18 KB)
π
tcpsock_posix.go
(6.16 KB)
π
tcpsock_test.go
(17.68 KB)
π
tcpsock_unix_test.go
(2.34 KB)
π
tcpsockopt_darwin.go
(770 B)
π
tcpsockopt_dragonfly.go
(698 B)
π
tcpsockopt_openbsd.go
(365 B)
π
tcpsockopt_plan9.go
(525 B)
π
tcpsockopt_posix.go
(442 B)
π
tcpsockopt_solaris.go
(1.15 KB)
π
tcpsockopt_stub.go
(399 B)
π
tcpsockopt_unix.go
(722 B)
π
tcpsockopt_windows.go
(741 B)
π
testdata
π
textproto
π
timeout_test.go
(29.11 KB)
π
udpsock.go
(11.83 KB)
π
udpsock_plan9.go
(4.64 KB)
π
udpsock_plan9_test.go
(1.31 KB)
π
udpsock_posix.go
(7.53 KB)
π
udpsock_test.go
(17.24 KB)
π
unixsock.go
(10.12 KB)
π
unixsock_linux_test.go
(2.29 KB)
π
unixsock_plan9.go
(1.24 KB)
π
unixsock_posix.go
(6.64 KB)
π
unixsock_readmsg_cloexec.go
(654 B)
π
unixsock_readmsg_cmsg_cloexec.go
(332 B)
π
unixsock_readmsg_other.go
(275 B)
π
unixsock_readmsg_test.go
(2.51 KB)
π
unixsock_test.go
(10.64 KB)
π
unixsock_windows_test.go
(2.03 KB)
π
url
π
write_unix_test.go
(1.61 KB)
π
writev_test.go
(5.03 KB)
π
writev_unix.go
(666 B)
Editing: interface_unix_test.go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd package net import ( "fmt" "os" "os/exec" "runtime" "strings" "testing" "time" ) type testInterface struct { name string local string remote string setupCmds []*exec.Cmd teardownCmds []*exec.Cmd } func (ti *testInterface) setup() error { for _, cmd := range ti.setupCmds { if out, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("args=%v out=%q err=%v", cmd.Args, string(out), err) } } return nil } func (ti *testInterface) teardown() error { for _, cmd := range ti.teardownCmds { if out, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("args=%v out=%q err=%v ", cmd.Args, string(out), err) } } return nil } func TestPointToPointInterface(t *testing.T) { if testing.Short() { t.Skip("avoid external network") } if runtime.GOOS == "darwin" || runtime.GOOS == "ios" { t.Skipf("not supported on %s", runtime.GOOS) } if os.Getuid() != 0 { t.Skip("must be root") } // We suppose that using IPv4 link-local addresses doesn't // harm anyone. local, remote := "169.254.0.1", "169.254.0.254" ip := ParseIP(remote) for i := 0; i < 3; i++ { ti := &testInterface{local: local, remote: remote} if err := ti.setPointToPoint(5963 + i); err != nil { t.Skipf("test requires external command: %v", err) } if err := ti.setup(); err != nil { if e := err.Error(); strings.Contains(e, "No such device") && strings.Contains(e, "gre0") { t.Skip("skipping test; no gre0 device. likely running in container?") } t.Fatal(err) } else { time.Sleep(3 * time.Millisecond) } ift, err := Interfaces() if err != nil { ti.teardown() t.Fatal(err) } for _, ifi := range ift { if ti.name != ifi.Name { continue } ifat, err := ifi.Addrs() if err != nil { ti.teardown() t.Fatal(err) } for _, ifa := range ifat { if ip.Equal(ifa.(*IPNet).IP) { ti.teardown() t.Fatalf("got %v", ifa) } } } if err := ti.teardown(); err != nil { t.Fatal(err) } else { time.Sleep(3 * time.Millisecond) } } } func TestInterfaceArrivalAndDeparture(t *testing.T) { if testing.Short() { t.Skip("avoid external network") } if os.Getuid() != 0 { t.Skip("must be root") } // We suppose that using IPv4 link-local addresses and the // dot1Q ID for Token Ring and FDDI doesn't harm anyone. local, remote := "169.254.0.1", "169.254.0.254" ip := ParseIP(remote) for _, vid := range []int{1002, 1003, 1004, 1005} { ift1, err := Interfaces() if err != nil { t.Fatal(err) } ti := &testInterface{local: local, remote: remote} if err := ti.setBroadcast(vid); err != nil { t.Skipf("test requires external command: %v", err) } if err := ti.setup(); err != nil { t.Fatal(err) } else { time.Sleep(3 * time.Millisecond) } ift2, err := Interfaces() if err != nil { ti.teardown() t.Fatal(err) } if len(ift2) <= len(ift1) { for _, ifi := range ift1 { t.Logf("before: %v", ifi) } for _, ifi := range ift2 { t.Logf("after: %v", ifi) } ti.teardown() t.Fatalf("got %v; want gt %v", len(ift2), len(ift1)) } for _, ifi := range ift2 { if ti.name != ifi.Name { continue } ifat, err := ifi.Addrs() if err != nil { ti.teardown() t.Fatal(err) } for _, ifa := range ifat { if ip.Equal(ifa.(*IPNet).IP) { ti.teardown() t.Fatalf("got %v", ifa) } } } if err := ti.teardown(); err != nil { t.Fatal(err) } else { time.Sleep(3 * time.Millisecond) } ift3, err := Interfaces() if err != nil { t.Fatal(err) } if len(ift3) >= len(ift2) { for _, ifi := range ift2 { t.Logf("before: %v", ifi) } for _, ifi := range ift3 { t.Logf("after: %v", ifi) } t.Fatalf("got %v; want lt %v", len(ift3), len(ift2)) } } } func TestInterfaceArrivalAndDepartureZoneCache(t *testing.T) { if testing.Short() { t.Skip("avoid external network") } if os.Getuid() != 0 { t.Skip("must be root") } // Ensure zoneCache is filled: _, _ = Listen("tcp", "[fe80::1%nonexistent]:0") ti := &testInterface{local: "fe80::1"} if err := ti.setLinkLocal(0); err != nil { t.Skipf("test requires external command: %v", err) } if err := ti.setup(); err != nil { if e := err.Error(); strings.Contains(e, "Permission denied") { t.Skipf("permission denied, skipping test: %v", e) } t.Fatal(err) } defer ti.teardown() time.Sleep(3 * time.Millisecond) // If Listen fails (on Linux with βbind: invalid argumentβ), zoneCache was // not updated when encountering a nonexistent interface: ln, err := Listen("tcp", "[fe80::1%"+ti.name+"]:0") if err != nil { t.Fatal(err) } ln.Close() if err := ti.teardown(); err != nil { t.Fatal(err) } }
Upload File
Create Folder