net

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr net.Addr

type Conn

type Conn interface {
	// Read reads data from the connection.
	// Read can be made to time out and return an error after a fixed
	// time limit; see SetDeadline and SetReadDeadline.
	Read(p []byte) (n int, err error)
	ReadBytes(delim byte) (b []byte, err error)
	ReadLine() (b []byte, err error)
	ReadString(delim byte) (s string, err error)
	ReadStringLine() (s string, err error)

	// Write writes data to the connection.
	// Write can be made to time out and return an error after a fixed
	// time limit; see SetDeadline and SetWriteDeadline.
	Write(p []byte) (n int, err error)
	WriteLine(p []byte) (n int, err error)
	WriteString(s string) (n int, err error)
	WriteStringLine(s string) (n int, err error)

	// Close closes the connection.
	// Any blocked Read or Write operations will be unblocked and return errors.
	Close() (err error)

	// LocalAddr returns the local network address, if known.
	LocalAddr() net.Addr

	// RemoteAddr returns the remote network address, if known.
	RemoteAddr() net.Addr

	// SetDeadline sets the read and write deadlines associated
	// with the connection. It is equivalent to calling both
	// SetReadDeadline and SetWriteDeadline.
	//
	// A deadline is an absolute time after which I/O operations
	// fail instead of blocking. The deadline applies to all future
	// and pending I/O, not just the immediately following call to
	// Read or Write. After a deadline has been exceeded, the
	// connection can be refreshed by setting a deadline in the future.
	//
	// If the deadline is exceeded a call to Read or Write or to other
	// I/O methods will return an error that wraps os.ErrDeadlineExceeded.
	// This can be tested using errors.Is(err, os.ErrDeadlineExceeded).
	// The error's Timeout method will return true, but note that there
	// are other possible errors for which the Timeout method will
	// return true even if the deadline has not been exceeded.
	//
	// An idle timeout can be implemented by repeatedly extending
	// the deadline after successful Read or Write calls.
	//
	// A zero value for t means I/O operations will not time out.
	SetDeadline(t time.Time) error

	// SetReadDeadline sets the deadline for future Read calls
	// and any currently-blocked Read call.
	// A zero value for t means Read will not time out.
	SetReadDeadline(t time.Time) error

	// SetWriteDeadline sets the deadline for future Write calls
	// and any currently-blocked Write call.
	// Even if write times out, it may return n > 0, indicating that
	// some of the data was successfully written.
	// A zero value for t means Write will not time out.
	SetWriteDeadline(t time.Time) error
}

func Dial

func Dial(network string, address string) (conn Conn, err error)

func DialTimeout

func DialTimeout(network string, address string, timeout time.Duration) (conn Conn, err error)

type Dialer

type Dialer net.Dialer

type IPAddr

type IPAddr net.IPAddr

type IPConn

type IPConn struct {
	// contains filtered or unexported fields
}

func DialIP

func DialIP(network string, laddr *IPAddr, raddr *IPAddr) (conn *IPConn, err error)

func (*IPConn) File

func (x *IPConn) File() (f *os.File, err error)

func (*IPConn) ReadFrom

func (x *IPConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*IPConn) ReadFromIP

func (x *IPConn) ReadFromIP(b []byte) (int, *net.IPAddr, error)

func (*IPConn) ReadMsgIP

func (x *IPConn) ReadMsgIP(b []byte, oob []byte) (n int, oobn int, flags int, addr *net.IPAddr, err error)

func (*IPConn) SetReadBuffer

func (x *IPConn) SetReadBuffer(bytes int) error

func (*IPConn) SetWriteBuffer

func (x *IPConn) SetWriteBuffer(bytes int) error

func (*IPConn) SyscallConn

func (x *IPConn) SyscallConn() (syscall.RawConn, error)

func (*IPConn) WriteMsgIP

func (x *IPConn) WriteMsgIP(b []byte, oob []byte, addr *net.IPAddr) (n int, oobn int, err error)

func (*IPConn) WriteTo

func (x *IPConn) WriteTo(b []byte, addr net.Addr) (int, error)

func (*IPConn) WriteToIP

func (x *IPConn) WriteToIP(b []byte, addr *net.IPAddr) (int, error)

type Listener

type Listener interface {
	// Accept waits for and returns the next connection to the listener.
	Accept() (conn Conn, err error)

	// Accept waits for and returns the next connection to the listener as an IOData channel.
	AcceptChan() (value chan gokit.IOData[Conn])

	// Close closes the listener.
	// Any blocked Accept operations will be unblocked and return errors.
	Close() error

	// Addr returns the listener's network address.
	Addr() Addr
}

func Listen

func Listen(network string, address string) (value Listener, err error)

func ListenTLS

func ListenTLS(network string, laddr string, config *TLSConfig) (value Listener, err error)

type TCPAddr

type TCPAddr net.TCPAddr

type TCPConn

type TCPConn struct {
	// contains filtered or unexported fields
}

func DialTCP

func DialTCP(network string, laddr *TCPAddr, raddr *TCPAddr) (conn *TCPConn, err error)

func (*TCPConn) CloseRead

func (x *TCPConn) CloseRead() error

func (*TCPConn) CloseWrite

func (x *TCPConn) CloseWrite() error

func (*TCPConn) File

func (x *TCPConn) File() (f *os.File, err error)

func (*TCPConn) MultipathTCP

func (x *TCPConn) MultipathTCP() (bool, error)

func (*TCPConn) ReadFrom

func (x *TCPConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*TCPConn) SetReadBuffer

func (x *TCPConn) SetReadBuffer(bytes int) error

func (*TCPConn) SetWriteBuffer

func (x *TCPConn) SetWriteBuffer(bytes int) error

func (*TCPConn) WriteTo

func (x *TCPConn) WriteTo(b []byte, addr net.Addr) (int, error)

type TLSConfig

type TLSConfig tls.Config

type TLSConn

type TLSConn struct {
	// contains filtered or unexported fields
}

func DialTLS

func DialTLS(network string, addr string, config *TLSConfig) (conn *TLSConn, err error)

func DialTLSWithDialer

func DialTLSWithDialer(dialer *Dialer, network string, addr string, config *TLSConfig) (conn *TLSConn, err error)

func (*TLSConn) Close

func (x *TLSConn) Close() (err error)

func (*TLSConn) CloseWrite

func (x *TLSConn) CloseWrite() error

func (*TLSConn) ConnectionState

func (x *TLSConn) ConnectionState() tls.ConnectionState

func (*TLSConn) Handshake

func (x *TLSConn) Handshake() error

func (*TLSConn) HandshakeContext

func (x *TLSConn) HandshakeContext(ctx context.Context) error

func (*TLSConn) LocalAddr

func (x *TLSConn) LocalAddr() net.Addr

func (*TLSConn) NetConn

func (x *TLSConn) NetConn() Conn

func (*TLSConn) OCSPResponse

func (x *TLSConn) OCSPResponse() []byte

func (*TLSConn) Read

func (x *TLSConn) Read(p []byte) (n int, err error)

func (*TLSConn) ReadBytes

func (x *TLSConn) ReadBytes(delim byte) (b []byte, err error)

func (*TLSConn) ReadLine

func (x *TLSConn) ReadLine() (b []byte, err error)

func (*TLSConn) ReadString

func (x *TLSConn) ReadString(delim byte) (s string, err error)

func (*TLSConn) ReadStringLine

func (x *TLSConn) ReadStringLine() (s string, err error)

func (*TLSConn) RemoteAddr

func (x *TLSConn) RemoteAddr() net.Addr

func (*TLSConn) SetDeadline

func (x *TLSConn) SetDeadline(t time.Time) error

func (*TLSConn) SetReadDeadline

func (x *TLSConn) SetReadDeadline(t time.Time) error

func (*TLSConn) SetWriteDeadline

func (x *TLSConn) SetWriteDeadline(t time.Time) error

func (*TLSConn) VerifyHostname

func (x *TLSConn) VerifyHostname(host string) error

func (*TLSConn) Write

func (x *TLSConn) Write(p []byte) (n int, err error)

func (*TLSConn) WriteLine

func (x *TLSConn) WriteLine(p []byte) (n int, err error)

func (*TLSConn) WriteString

func (x *TLSConn) WriteString(s string) (n int, err error)

func (*TLSConn) WriteStringLine

func (x *TLSConn) WriteStringLine(s string) (n int, err error)

type TLSDialer

type TLSDialer tls.Dialer

type UDPAddr

type UDPAddr net.UDPAddr

type UDPConn

type UDPConn struct {
	// contains filtered or unexported fields
}

func DialUDP

func DialUDP(network string, laddr *UDPAddr, raddr *UDPAddr) (conn *UDPConn, err error)

func (*UDPConn) File

func (x *UDPConn) File() (f *os.File, err error)

func (*UDPConn) ReadFrom

func (x *UDPConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*UDPConn) ReadFromUDP

func (x *UDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error)

func (*UDPConn) ReadFromUDPAddrPort

func (x *UDPConn) ReadFromUDPAddrPort(b []byte) (n int, addr netip.AddrPort, err error)

func (*UDPConn) ReadMsgUDP

func (x *UDPConn) ReadMsgUDP(b []byte, oob []byte) (n int, oobn int, flags int, addr *net.UDPAddr, err error)

func (*UDPConn) ReadMsgUDPAddrPort

func (x *UDPConn) ReadMsgUDPAddrPort(b []byte, oob []byte) (n int, oobn int, flags int, addr netip.AddrPort, err error)

func (*UDPConn) SetReadBuffer

func (x *UDPConn) SetReadBuffer(bytes int) error

func (*UDPConn) SetWriteBuffer

func (x *UDPConn) SetWriteBuffer(bytes int) error

func (*UDPConn) SyscallConn

func (x *UDPConn) SyscallConn() (syscall.RawConn, error)

func (*UDPConn) WriteMsgUDP

func (x *UDPConn) WriteMsgUDP(b []byte, oob []byte, addr *net.UDPAddr) (n int, oobn int, err error)

func (*UDPConn) WriteMsgUDPAddrPort

func (x *UDPConn) WriteMsgUDPAddrPort(b []byte, oob []byte, addr netip.AddrPort) (n int, oobn int, err error)

func (*UDPConn) WriteTo

func (x *UDPConn) WriteTo(b []byte, addr net.Addr) (int, error)

func (*UDPConn) WriteToUDP

func (x *UDPConn) WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)

func (*UDPConn) WriteToUDPAddrPort

func (x *UDPConn) WriteToUDPAddrPort(b []byte, addr netip.AddrPort) (int, error)

type UnixAddr

type UnixAddr net.UnixAddr

type UnixConn

type UnixConn struct {
	// contains filtered or unexported fields
}

func DialUnix

func DialUnix(network string, laddr *UnixAddr, raddr *UnixAddr) (conn *UnixConn, err error)

func (*UnixConn) CloseRead

func (x *UnixConn) CloseRead() error

func (*UnixConn) CloseWrite

func (x *UnixConn) CloseWrite() error

func (*UnixConn) File

func (x *UnixConn) File() (f *os.File, err error)

func (*UnixConn) ReadFrom

func (x *UnixConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*UnixConn) ReadFromUnix

func (x *UnixConn) ReadFromUnix(b []byte) (int, *net.UnixAddr, error)

func (*UnixConn) ReadMsgUnix

func (x *UnixConn) ReadMsgUnix(b []byte, oob []byte) (n int, oobn int, flags int, addr *net.UnixAddr, err error)

func (*UnixConn) SetReadBuffer

func (x *UnixConn) SetReadBuffer(bytes int) error

func (*UnixConn) SetWriteBuffer

func (x *UnixConn) SetWriteBuffer(bytes int) error

func (*UnixConn) SyscallConn

func (x *UnixConn) SyscallConn() (syscall.RawConn, error)

func (*UnixConn) WriteMsgUnix

func (x *UnixConn) WriteMsgUnix(b []byte, oob []byte, addr *net.UnixAddr) (n int, oobn int, err error)

func (*UnixConn) WriteTo

func (x *UnixConn) WriteTo(b []byte, addr net.Addr) (int, error)

func (*UnixConn) WriteToUnix

func (x *UnixConn) WriteToUnix(b []byte, addr *net.UnixAddr) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL