package socktest
Import Path
net/internal/socktest (on go.dev)
Dependency Relation
imports 3 packages, and imported by 0 packages
Involved Source Files
Package socktest provides utilities for socket testing.
switch_posix.go
switch_unix.go
sys_cloexec.go
sys_unix.go
Package-Level Type Names (total 8)
An AfterFilter represents a socket system call filter after an
execution of a system call.
It will only be executed after a system call for a socket that has
an entry in internal table.
If the filter returns a non-nil error, the system call function
returns the non-nil error.
A Cookie represents a 3-tuple of a socket; address family, socket
type and protocol number.
Family returns an address family.
Protocol returns a protocol number.
Type returns a socket type.
A Filter represents a socket system call filter.
It will only be executed before a system call for a socket that has
an entry in internal table.
If the filter returns a non-nil error, the execution of system call
will be canceled and the system call function returns the non-nil
error.
It can return a non-nil [AfterFilter] for filtering after the
execution of the system call.
func (*Switch).Set(t FilterType, f Filter)
A FilterType represents a filter type.
func (*Switch).Set(t FilterType, f Filter)
const FilterAccept
const FilterClose
const FilterConnect
const FilterGetsockoptInt
const FilterListen
const FilterSocket
A Stat represents a per-cookie socket statistics.
// number of sockets accept failed
// number of sockets accepted
// number of sockets close failed
// number of sockets closed
// number of sockets connect failed
// number of sockets connected
// address family
// number of sockets listen failed
// number of sockets listened
// number of sockets open failed
// number of sockets opened
// protocol number
// socket type
( Stat) String() string
Stat : expvar.Var
Stat : fmt.Stringer
func (*Switch).Stats() []Stat
A Status represents the status of a socket.
Cookie Cookie
// error status of socket system call
// error status of socket by SO_ERROR
( Status) String() string
Status : expvar.Var
Status : fmt.Stringer
A Switch represents a callpath point switch for socket system
calls.
Accept wraps syscall.Accept.
Accept4 wraps syscall.Accept4.
Close wraps syscall.Close.
Connect wraps syscall.Connect.
GetsockoptInt wraps syscall.GetsockoptInt.
Listen wraps syscall.Listen.
Set deploys the socket system call filter f for the filter type t.
Socket wraps [syscall.Socket].
Sockets returns mappings of socket descriptor to socket status.
Stats returns a list of per-cookie socket statistics.
Package-Level Constants (total 6)
const FilterAccept FilterType = 3 // for Accept, Accept4 or AcceptEx const FilterClose FilterType = 5 // for Close or Closesocket const FilterConnect FilterType = 1 // for Connect or ConnectEx const FilterGetsockoptInt FilterType = 4 // for GetsockoptInt const FilterListen FilterType = 2 // for Listen const FilterSocket FilterType = 0 // for Socket
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |