Movatterモバイル変換


[0]ホーム

URL:


gonet

package
v0.0.0-...-e79ac37Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License:Apache-2.0, BSD-3-Clause, MITImports:13Imported by:290

Details

Repository

github.com/google/gvisor

Links

Documentation

Overview

Package gonet provides a Go net package compatible wrapper for a tcpip stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeTCPConn

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

A TCPConn is a wrapper around a TCP tcpip.Endpoint that implements the net.Conninterface.

funcDialContextTCP

func DialContextTCP(ctxcontext.Context, s *stack.Stack, addrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPConn,error)

DialContextTCP creates a new TCPConn connected to the specified addresswith the option of adding cancellation and timeouts.

funcDialTCP

DialTCP creates a new TCPConn connected to the specified address.

funcDialTCPWithBind

func DialTCPWithBind(ctxcontext.Context, s *stack.Stack, localAddr, remoteAddrtcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*TCPConn,error)

DialTCPWithBind creates a new TCPConn connected to the specifiedremoteAddress with its local address bound to localAddr.

funcNewTCPConn

func NewTCPConn(wq *waiter.Queue, eptcpip.Endpoint) *TCPConn

NewTCPConn creates a new TCPConn.

func (*TCPConn)Close

func (c *TCPConn) Close()error

Close implements net.Conn.Close.

func (*TCPConn)CloseRead

func (c *TCPConn) CloseRead()error

CloseRead shuts down the reading side of the TCP connection. Most callersshould just use Close.

A TCP Half-Close is performed the same as CloseRead for *net.TCPConn.

func (*TCPConn)CloseWrite

func (c *TCPConn) CloseWrite()error

CloseWrite shuts down the writing side of the TCP connection. Most callersshould just use Close.

A TCP Half-Close is performed the same as CloseWrite for *net.TCPConn.

func (*TCPConn)LocalAddr

func (c *TCPConn) LocalAddr()net.Addr

LocalAddr implements net.Conn.LocalAddr.

func (*TCPConn)Read

func (c *TCPConn) Read(b []byte) (int,error)

Read implements net.Conn.Read.

func (*TCPConn)RemoteAddr

func (c *TCPConn) RemoteAddr()net.Addr

RemoteAddr implements net.Conn.RemoteAddr.

func (*TCPConn)SetDeadline

func (d *TCPConn) SetDeadline(ttime.Time)error

SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.

func (*TCPConn)SetReadDeadline

func (d *TCPConn) SetReadDeadline(ttime.Time)error

SetReadDeadline implements net.Conn.SetReadDeadline andnet.PacketConn.SetReadDeadline.

func (*TCPConn)SetWriteDeadline

func (d *TCPConn) SetWriteDeadline(ttime.Time)error

SetWriteDeadline implements net.Conn.SetWriteDeadline andnet.PacketConn.SetWriteDeadline.

func (*TCPConn)Write

func (c *TCPConn) Write(b []byte) (int,error)

Write implements net.Conn.Write.

typeTCPListener

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

A TCPListener is a wrapper around a TCP tcpip.Endpoint that implementsnet.Listener.

funcListenTCP

ListenTCP creates a new TCPListener.

funcNewTCPListener

func NewTCPListener(s *stack.Stack, wq *waiter.Queue, eptcpip.Endpoint) *TCPListener

NewTCPListener creates a new TCPListener from a listening tcpip.Endpoint.

func (*TCPListener)Accept

func (l *TCPListener) Accept() (net.Conn,error)

Accept implements net.Conn.Accept.

func (*TCPListener)Addr

func (l *TCPListener) Addr()net.Addr

Addr implements net.Listener.Addr.

func (*TCPListener)Close

func (l *TCPListener) Close()error

Close implements net.Listener.Close.

func (*TCPListener)Shutdown

func (l *TCPListener) Shutdown()

Shutdown stops the HTTP server.

typeUDPConn

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

A UDPConn is a wrapper around a UDP tcpip.Endpoint that implementsnet.Conn and net.PacketConn.

funcDialUDP

func DialUDP(s *stack.Stack, laddr, raddr *tcpip.FullAddress, networktcpip.NetworkProtocolNumber) (*UDPConn,error)

DialUDP creates a new UDPConn.

If laddr is nil, a local address is automatically chosen.

If raddr is nil, the UDPConn is left unconnected.

funcNewUDPConn

func NewUDPConn(wq *waiter.Queue, eptcpip.Endpoint) *UDPConn

NewUDPConn creates a new UDPConn.

func (*UDPConn)Close

func (c *UDPConn) Close()error

Close implements net.PacketConn.Close.

func (*UDPConn)LocalAddr

func (c *UDPConn) LocalAddr()net.Addr

LocalAddr implements net.PacketConn.LocalAddr.

func (*UDPConn)Read

func (c *UDPConn) Read(b []byte) (int,error)

Read implements net.Conn.Read

func (*UDPConn)ReadFrom

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

ReadFrom implements net.PacketConn.ReadFrom.

func (*UDPConn)RemoteAddr

func (c *UDPConn) RemoteAddr()net.Addr

RemoteAddr implements net.Conn.RemoteAddr.

func (*UDPConn)SetDeadline

func (d *UDPConn) SetDeadline(ttime.Time)error

SetDeadline implements net.Conn.SetDeadline and net.PacketConn.SetDeadline.

func (*UDPConn)SetReadDeadline

func (d *UDPConn) SetReadDeadline(ttime.Time)error

SetReadDeadline implements net.Conn.SetReadDeadline andnet.PacketConn.SetReadDeadline.

func (*UDPConn)SetWriteDeadline

func (d *UDPConn) SetWriteDeadline(ttime.Time)error

SetWriteDeadline implements net.Conn.SetWriteDeadline andnet.PacketConn.SetWriteDeadline.

func (*UDPConn)Write

func (c *UDPConn) Write(b []byte) (int,error)

func (*UDPConn)WriteTo

func (c *UDPConn) WriteTo(b []byte, addrnet.Addr) (int,error)

WriteTo implements net.PacketConn.WriteTo.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp