Involved Source Files Package transport implements various networking related
functions used throughout the Pion modules.
Package-Level Type Names (total 6)
/* sort by: | */
Dialer is identical to net.Dialer excepts that its methods
(Dial, DialContext) are overridden to use the Net interface.
Use vnet.CreateDialer() to create an instance of this Dialer.( Dialer) Dial(network, address string) (net.Conn, error)Net(interface)
*github.com/pion/transport/v3/stdnet.Net
*github.com/pion/transport/v3/vnet.Net
github.com/pion/transport/v2.Dialer(interface)
github.com/pion/transport/v2.Net(interface)
*github.com/pion/transport/v2/stdnet.Net
*github.com/pion/turn/v4/internal/client.TCPAllocation
github.com/nats-io/nats.go.CustomDialer(interface)
*crypto/tls.Dialer
*golang.org/x/crypto/ssh.Client
*golang.org/x/net/internal/socks.Dialer
golang.org/x/net/proxy.Dialer(interface)
*golang.org/x/net/proxy.PerHost
*net.Dialer
Dialer : github.com/pion/transport/v2.Dialer
Dialer : github.com/nats-io/nats.go.CustomDialer
Dialer : golang.org/x/net/proxy.Dialer
func Net.CreateDialer(dialer *net.Dialer) Dialer
func github.com/pion/transport/v3/stdnet.(*Net).CreateDialer(d *net.Dialer) Dialer
func github.com/pion/transport/v3/vnet.(*Net).CreateDialer(d *net.Dialer) Dialer
Interface wraps a standard net.Interfaces and its assigned addressesInterfacenet.Interface // e.g., FlagUp, FlagLoopback, FlagMulticast // IEEE MAC-48, EUI-48 and EUI-64 form // positive integer that starts at one, zero is never used // maximum transmission unit // e.g., "en0", "lo0", "eth0.100"; may be the empty string AddAddress adds a new address to the interface Addrs returns a slice of configured addresses on the interface MulticastAddrs returns a list of multicast, joined group addresses
for a specific interface.
func NewInterface(ifc net.Interface) *Interface
func Net.InterfaceByIndex(index int) (*Interface, error)
func Net.InterfaceByName(name string) (*Interface, error)
func Net.Interfaces() ([]*Interface, error)
func github.com/pion/transport/v3/stdnet.(*Net).InterfaceByIndex(index int) (*Interface, error)
func github.com/pion/transport/v3/stdnet.(*Net).InterfaceByName(name string) (*Interface, error)
func github.com/pion/transport/v3/stdnet.(*Net).Interfaces() ([]*Interface, error)
func github.com/pion/transport/v3/vnet.(*Net).InterfaceByIndex(index int) (*Interface, error)
func github.com/pion/transport/v3/vnet.(*Net).InterfaceByName(ifName string) (*Interface, error)
func github.com/pion/transport/v3/vnet.(*Net).Interfaces() ([]*Interface, error)
Net is an interface providing common networking functions which are
similar to the functions provided by standard net package.( Net) CreateDialer(dialer *net.Dialer) Dialer Dial connects to the address on the named network.
Known networks are "tcp", "tcp4" (IPv4-only), "tcp6" (IPv6-only),
"udp", "udp4" (IPv4-only), "udp6" (IPv6-only), "ip", "ip4"
(IPv4-only), "ip6" (IPv6-only), "unix", "unixgram" and
"unixpacket".
For TCP and UDP networks, the address has the form "host:port".
The host must be a literal IP address, or a host name that can be
resolved to IP addresses.
The port must be a literal port number or a service name.
If the host is a literal IPv6 address it must be enclosed in square
brackets, as in "[2001:db8::1]:80" or "[fe80::1%zone]:80".
The zone specifies the scope of the literal IPv6 address as defined
in RFC 4007.
The functions JoinHostPort and SplitHostPort manipulate a pair of
host and port in this form.
When using TCP, and the host resolves to multiple IP addresses,
Dial will try each IP address in order until one succeeds.
Examples:
Dial("tcp", "golang.org:http")
Dial("tcp", "192.0.2.1:http")
Dial("tcp", "198.51.100.1:80")
Dial("udp", "[2001:db8::1]:domain")
Dial("udp", "[fe80::1%lo0]:53")
Dial("tcp", ":80")
For IP networks, the network must be "ip", "ip4" or "ip6" followed
by a colon and a literal protocol number or a protocol name, and
the address has the form "host". The host must be a literal IP
address or a literal IPv6 address with zone.
It depends on each operating system how the operating system
behaves with a non-well known protocol number such as "0" or "255".
Examples:
Dial("ip4:1", "192.0.2.1")
Dial("ip6:ipv6-icmp", "2001:db8::1")
Dial("ip6:58", "fe80::1%lo0")
For TCP, UDP and IP networks, if the host is empty or a literal
unspecified IP address, as in ":80", "0.0.0.0:80" or "[::]:80" for
TCP and UDP, "", "0.0.0.0" or "::" for IP, the local system is
assumed.
For Unix networks, the address must be a file system path. DialTCP acts like Dial for TCP networks.
The network must be a TCP network name; see func Dial for details.
If laddr is nil, a local address is automatically chosen.
If the IP field of raddr is nil or an unspecified IP address, the
local system is assumed. DialUDP acts like Dial for UDP networks.
The network must be a UDP network name; see func Dial for details.
If laddr is nil, a local address is automatically chosen.
If the IP field of raddr is nil or an unspecified IP address, the
local system is assumed. InterfaceByIndex returns the interface specified by index.
On Solaris, it returns one of the logical network interfaces
sharing the logical data link; for more precision use
InterfaceByName. InterfaceByName returns the interface specified by name. Interfaces returns a list of the system's network interfaces. ListenPacket announces on the local network address.
The network must be "udp", "udp4", "udp6", "unixgram", or an IP
transport. The IP transports are "ip", "ip4", or "ip6" followed by
a colon and a literal protocol number or a protocol name, as in
"ip:1" or "ip:icmp".
For UDP and IP networks, if the host in the address parameter is
empty or a literal unspecified IP address, ListenPacket listens on
all available IP addresses of the local system except multicast IP
addresses.
To only use IPv4, use network "udp4" or "ip4:proto".
The address can use a host name, but this is not recommended,
because it will create a listener for at most one of the host's IP
addresses.
If the port in the address parameter is empty or "0", as in
"127.0.0.1:" or "[::1]:0", a port number is automatically chosen.
The LocalAddr method of PacketConn can be used to discover the
chosen port.
See func Dial for a description of the network and address
parameters.
ListenPacket uses context.Background internally; to specify the context, use
ListenConfig.ListenPacket. ListenTCP acts like Listen for TCP networks.
The network must be a TCP network name; see func Dial for details.
If the IP field of laddr is nil or an unspecified IP address,
ListenTCP listens on all available unicast and anycast IP addresses
of the local system.
If the Port field of laddr is 0, a port number is automatically
chosen. ListenUDP acts like ListenPacket for UDP networks.
The network must be a UDP network name; see func Dial for details.
If the IP field of laddr is nil or an unspecified IP address,
ListenUDP listens on all available IP addresses of the local system
except multicast IP addresses.
If the Port field of laddr is 0, a port number is automatically
chosen. ResolveIPAddr returns an address of IP end point.
The network must be an IP network name.
If the host in the address parameter is not a literal IP address,
ResolveIPAddr resolves the address to an address of IP end point.
Otherwise, it parses the address as a literal IP address.
The address parameter can use a host name, but this is not
recommended, because it will return at most one of the host name's
IP addresses.
See func Dial for a description of the network and address
parameters. ResolveTCPAddr returns an address of TCP end point.
The network must be a TCP network name.
If the host in the address parameter is not a literal IP address or
the port is not a literal port number, ResolveTCPAddr resolves the
address to an address of TCP end point.
Otherwise, it parses the address as a pair of literal IP address
and port number.
The address parameter can use a host name, but this is not
recommended, because it will return at most one of the host name's
IP addresses.
See func Dial for a description of the network and address
parameters. ResolveUDPAddr returns an address of UDP end point.
The network must be a UDP network name.
If the host in the address parameter is not a literal IP address or
the port is not a literal port number, ResolveUDPAddr resolves the
address to an address of UDP end point.
Otherwise, it parses the address as a pair of literal IP address
and port number.
The address parameter can use a host name, but this is not
recommended, because it will return at most one of the host name's
IP addresses.
See func Dial for a description of the network and address
parameters.
*github.com/pion/transport/v3/stdnet.Net
*github.com/pion/transport/v3/vnet.Net
Net : Dialer
Net : github.com/pion/transport/v2.Dialer
Net : github.com/nats-io/nats.go.CustomDialer
Net : golang.org/x/net/proxy.Dialer
func github.com/pion/ice/v4.UDPMuxFromPortWithNet(n Net) ice.UDPMuxFromPortOption
func github.com/pion/webrtc/v4.(*SettingEngine).SetNet(net Net)
TCPConn is an interface for TCP network connections. Close closes the connection.
Any blocked Read or Write operations will be unblocked and return errors.
Close may or may not block until any buffered data is sent;
for TCP connections see [*TCPConn.SetLinger]. CloseRead shuts down the reading side of the TCP connection.
Most callers should just use Close. CloseWrite shuts down the writing side of the TCP connection.
Most callers should just use Close. LocalAddr returns the local network address, if known. 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. ReadFrom implements the io.ReaderFrom ReadFrom method. RemoteAddr returns the remote network address, if known. 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. SetKeepAlive sets whether the operating system should send
keep-alive messages on the connection. SetKeepAlivePeriod sets period between keep-alives. SetLinger sets the behavior of Close on a connection which still
has data waiting to be sent or to be acknowledged.
If sec < 0 (the default), the operating system finishes sending the
data in the background.
If sec == 0, the operating system discards any unsent or
unacknowledged data.
If sec > 0, the data is sent in the background as with sec < 0. On
some operating systems after sec seconds have elapsed any remaining
unsent data may be discarded. SetNoDelay controls whether the operating system should delay
packet transmission in hopes of sending fewer packets (Nagle's
algorithm). The default is true (no delay), meaning that data is
sent as soon as possible after a Write. SetReadBuffer sets the size of the operating system's
receive buffer associated with the connection. 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. SetWriteBuffer sets the size of the operating system's
transmit buffer associated with the connection. 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. 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.
github.com/pion/transport/v2.TCPConn(interface)
*github.com/pion/turn/v4/internal/client.TCPConn
*net.TCPConn
TCPConn : github.com/pion/transport/v2.TCPConn
TCPConn : github.com/pion/datachannel.ReadDeadliner
TCPConn : github.com/pion/datachannel.WriteDeadliner
TCPConn : github.com/pion/stun.Connection
TCPConn : github.com/pion/stun/v3.Connection
TCPConn : github.com/miekg/dns.Writer
TCPConn : github.com/prometheus/common/expfmt.Closer
TCPConn : internal/bisect.Writer
TCPConn : io.Closer
TCPConn : io.ReadCloser
TCPConn : io.Reader
TCPConn : io.ReaderFrom
TCPConn : io.ReadWriteCloser
TCPConn : io.ReadWriter
TCPConn : io.WriteCloser
TCPConn : io.Writer
TCPConn : net.Conn
func Net.DialTCP(network string, laddr, raddr *net.TCPAddr) (TCPConn, error)
func TCPListener.AcceptTCP() (TCPConn, error)
func github.com/pion/transport/v3/stdnet.(*Net).DialTCP(network string, laddr, raddr *net.TCPAddr) (TCPConn, error)
func github.com/pion/transport/v3/vnet.(*Net).DialTCP(string, *net.TCPAddr, *net.TCPAddr) (TCPConn, error)
func github.com/pion/turn/v4/internal/client.(*TCPAllocation).AcceptTCP() (TCPConn, error)
TCPListener is a TCP network listener. Clients should typically
use variables of type Listener instead of assuming TCP. Accept waits for and returns the next connection to the listener. AcceptTCP accepts the next incoming call and returns the new
connection. Addr returns the listener's network address. Close closes the listener.
Any blocked Accept operations will be unblocked and return errors. SetDeadline sets the deadline associated with the listener.
A zero time value disables the deadline.
*github.com/pion/turn/v4/internal/client.TCPAllocation
TCPListener : github.com/prometheus/common/expfmt.Closer
TCPListener : io.Closer
TCPListener : net.Listener
func Net.ListenTCP(network string, laddr *net.TCPAddr) (TCPListener, error)
func github.com/pion/transport/v3/stdnet.(*Net).ListenTCP(network string, laddr *net.TCPAddr) (TCPListener, error)
func github.com/pion/transport/v3/vnet.(*Net).ListenTCP(string, *net.TCPAddr) (TCPListener, error)
UDPConn is packet-oriented connection for UDP. Close closes the connection.
Any blocked Read or Write operations will be unblocked and return errors. LocalAddr returns the local network address, if known. 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. ReadFrom reads a packet from the connection,
copying the payload into p. It returns the number of
bytes copied into p and the return address that
was on the packet.
It returns the number of bytes read (0 <= n <= len(p))
and any error encountered. Callers should always process
the n > 0 bytes returned before considering the error err.
ReadFrom can be made to time out and return an error after a
fixed time limit; see SetDeadline and SetReadDeadline. ReadFromUDP acts like ReadFrom but returns a UDPAddr. ReadMsgUDP reads a message from c, copying the payload into b and
the associated out-of-band data into oob. It returns the number of
bytes copied into b, the number of bytes copied into oob, the flags
that were set on the message and the source address of the message.
The packages golang.org/x/net/ipv4 and golang.org/x/net/ipv6 can be
used to manipulate IP-level socket options in oob. RemoteAddr returns the remote network address, if known. 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. SetReadBuffer sets the size of the operating system's
receive buffer associated with the connection. 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. SetWriteBuffer sets the size of the operating system's
transmit buffer associated with the connection. 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. 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. WriteMsgUDP writes a message to addr via c if c isn't connected, or
to c's remote address if c is connected (in which case addr must be
nil). The payload is copied from b and the associated out-of-band
data is copied from oob. It returns the number of payload and
out-of-band bytes written.
The packages golang.org/x/net/ipv4 and golang.org/x/net/ipv6 can be
used to manipulate IP-level socket options in oob. WriteTo writes a packet with payload p to addr.
WriteTo can be made to time out and return an Error after a
fixed time limit; see SetDeadline and SetWriteDeadline.
On packet-oriented connections, write timeouts are rare. WriteToUDP acts like WriteTo but takes a UDPAddr.
*github.com/pion/transport/v3/vnet.UDPConn
github.com/pion/transport/v2.UDPConn(interface)
*net.UDPConn
UDPConn : github.com/pion/transport/v2.UDPConn
UDPConn : github.com/pion/datachannel.ReadDeadliner
UDPConn : github.com/pion/datachannel.WriteDeadliner
UDPConn : github.com/pion/stun.Connection
UDPConn : github.com/pion/stun/v3.Connection
UDPConn : github.com/miekg/dns.Writer
UDPConn : github.com/prometheus/common/expfmt.Closer
UDPConn : internal/bisect.Writer
UDPConn : io.Closer
UDPConn : io.ReadCloser
UDPConn : io.Reader
UDPConn : io.ReadWriteCloser
UDPConn : io.ReadWriter
UDPConn : io.WriteCloser
UDPConn : io.Writer
UDPConn : net.Conn
UDPConn : net.PacketConn
func Net.DialUDP(network string, laddr, raddr *net.UDPAddr) (UDPConn, error)
func Net.ListenUDP(network string, locAddr *net.UDPAddr) (UDPConn, error)
func github.com/pion/transport/v3/stdnet.(*Net).DialUDP(network string, laddr, raddr *net.UDPAddr) (UDPConn, error)
func github.com/pion/transport/v3/stdnet.(*Net).ListenUDP(network string, locAddr *net.UDPAddr) (UDPConn, error)
func github.com/pion/transport/v3/vnet.(*Net).DialUDP(network string, locAddr, remAddr *net.UDPAddr) (UDPConn, error)
func github.com/pion/transport/v3/vnet.(*Net).ListenUDP(network string, locAddr *net.UDPAddr) (UDPConn, error)
Package-Level Functions (only one)
NewInterface creates a new interface based of a standard net.Interface
Package-Level Variables (total 4)
ErrInterfaceNotFound ...
ErrNoAddressAssigned ...
ErrNotSupported ...
ErrNotUDPAddress ...
The pages are generated with Goldsv0.8.2. (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.