Discover Packages
v.io
x
ref
runtime
protocols
lib
tcputil
package
Version:
v0.1.17
Opens a new window with list of versions in this module.
Published: Jun 7, 2021
License: BSD-3-Clause
Opens a new window with license information.
Imports: 5
Opens a new window with list of imports.
Imported by: 8
Opens a new window with list of known importers.
Documentation
Documentation
¶
package tcputil contains functions commonly used to manipulate TCP
connections.
func EnableTCPKeepAlive(conn net.Conn) error
func NewTCPConn(c net.Conn) flow.Conn
func TCPResolveAddrs(ctx *context.T, address string) ([]string, error)
type TCP
func (TCP) Dial(ctx *context.T, network, address string, timeout time.Duration) (flow.Conn, error)
func (TCP) Listen(ctx *context.T, network, address string) (flow.Listener, error)
func (TCP) Resolve(ctx *context.T, network, address string) (string, []string, error)
EnableTCPKeepAlive enabled the KeepAlive option on a TCP connection.
Some cloud providers (like Google Compute Engine) blackhole inactive TCP
connections, we need to set TCP keep alive option to prevent that.
See: https://developers.google.com/compute/docs/troubleshooting#communicatewithinternet
The same problem can happen when one end of a TCP connection dies and the
TCP FIN or RST packet doesn't reach the other end, e.g. when the machine
dies, falls off the network, or when there is packet loss. So, it is best to
enable this option for all TCP connections.
Dial dials a net.Conn to a the specific address and adds framing to the connection.
Listen returns a listener that sets KeepAlive on all accepted connections.
Connections returned from the listener will be framed.
Resolve performs a DNS resolution on the provided network and address.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.