v.io: v.io/x/ref/runtime/protocols/lib/tcputil Index | Files

package tcputil

import "v.io/x/ref/runtime/protocols/lib/tcputil"

package tcputil contains functions commonly used to manipulate TCP connections.


Package Files


func EnableTCPKeepAlive Uses

func EnableTCPKeepAlive(conn net.Conn) 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.

func NewTCPConn Uses

func NewTCPConn(c net.Conn) flow.Conn

func TCPResolveAddrs Uses

func TCPResolveAddrs(ctx *context.T, address string) ([]string, error)

type TCP Uses

type TCP struct{}

func (TCP) Dial Uses

func (TCP) Dial(ctx *context.T, network, address string, timeout time.Duration) (flow.Conn, error)

Dial dials a net.Conn to a the specific address and adds framing to the connection.

func (TCP) Listen Uses

func (TCP) Listen(ctx *context.T, network, address string) (flow.Listener, error)

Listen returns a listener that sets KeepAlive on all accepted connections. Connections returned from the listener will be framed.

func (TCP) Resolve Uses

func (TCP) Resolve(ctx *context.T, network, address string) (string, []string, error)

Resolve performs a DNS resolution on the provided network and address.

Package tcputil imports 5 packages (graph) and is imported by 3 packages. Updated 2020-06-09. Refresh now. Tools for package owners.