socket

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package socket provides outbound network sockets.

This package is only required in the classic App Engine environment. Applications running only in App Engine "flexible environment" should use the standard library's net package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupIP

func LookupIP(ctx context.Context, host string) (addrs []net.IP, err error)

LookupIP returns the given host's IP addresses.

Types

type Conn

type Conn struct {
	net.Conn
}

Conn represents a socket connection. It implements net.Conn.

func Dial

func Dial(ctx context.Context, protocol, addr string) (*Conn, error)

Dial connects to the address addr on the network protocol. The address format is host:port, where host may be a hostname or an IP address. Known protocols are "tcp" and "udp". The returned connection satisfies net.Conn, and is valid while ctx is valid; if the connection is to be used after ctx becomes invalid, invoke SetContext with the new context.

func DialTimeout

func DialTimeout(ctx context.Context, protocol, addr string, timeout time.Duration) (*Conn, error)

DialTimeout is like Dial but takes a timeout. The timeout includes name resolution, if required.

func (*Conn) KeepAlive

func (cn *Conn) KeepAlive() error

KeepAlive signals that the connection is still in use. It may be called to prevent the socket being closed due to inactivity.

func (*Conn) SetContext

func (cn *Conn) SetContext(ctx context.Context)

SetContext sets the context that is used by this Conn. It is usually used only when using a Conn that was created in a different context, such as when a connection is created during a warmup request but used while servicing a user request.

Jump to

Keyboard shortcuts

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