Version: v0.6.2 Latest Latest

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

Go to latest
Published: Sep 22, 2016 License: Apache-2.0 Imports: 27 Imported by: 0




View Source
const DefaultMaxIdleConnsPerHost = 2

DefaultMaxIdleConnsPerHost is the default value of Transport's MaxIdleConnsPerHost.


This section is empty.


func NewRemoteManager

func NewRemoteManager(listenAddr, cafile, certfile, keyfile string) (subnet.Manager, error)

func RunServer

func RunServer(ctx context.Context, sm subnet.Manager, listenAddr, cafile, certfile, keyfile string)


type RemoteManager

type RemoteManager struct {
	// contains filtered or unexported fields

implements subnet.Manager by sending requests to the server

func (*RemoteManager) AcquireLease

func (m *RemoteManager) AcquireLease(ctx context.Context, network string, attrs *subnet.LeaseAttrs) (*subnet.Lease, error)

func (*RemoteManager) AddReservation added in v0.5.6

func (m *RemoteManager) AddReservation(ctx context.Context, network string, r *subnet.Reservation) error

func (*RemoteManager) GetNetworkConfig

func (m *RemoteManager) GetNetworkConfig(ctx context.Context, network string) (*subnet.Config, error)

func (*RemoteManager) ListReservations added in v0.5.6

func (m *RemoteManager) ListReservations(ctx context.Context, network string) ([]subnet.Reservation, error)

func (*RemoteManager) RemoveReservation added in v0.5.6

func (m *RemoteManager) RemoveReservation(ctx context.Context, network string, sn ip.IP4Net) error

func (*RemoteManager) RenewLease

func (m *RemoteManager) RenewLease(ctx context.Context, network string, lease *subnet.Lease) error

func (*RemoteManager) RevokeLease added in v0.5.6

func (m *RemoteManager) RevokeLease(ctx context.Context, network string, sn ip.IP4Net) error

func (*RemoteManager) WatchLease added in v0.5.6

func (m *RemoteManager) WatchLease(ctx context.Context, network string, sn ip.IP4Net, cursor interface{}) (subnet.LeaseWatchResult, error)

func (*RemoteManager) WatchLeases

func (m *RemoteManager) WatchLeases(ctx context.Context, network string, cursor interface{}) (subnet.LeaseWatchResult, error)

func (*RemoteManager) WatchNetworks added in v0.5.6

func (m *RemoteManager) WatchNetworks(ctx context.Context, cursor interface{}) (subnet.NetworkWatchResult, error)

type Transport added in v0.5.3

type Transport struct {

	// Dial specifies the dial function for creating unencrypted
	// TCP connections.
	// If Dial is nil, net.Dial is used.
	Dial func(network, addr string) (net.Conn, error)

	// DialTLS specifies an optional dial function for creating
	// TLS connections for non-proxied HTTPS requests.
	// If DialTLS is nil, Dial and TLSClientConfig are used.
	// If DialTLS is set, the Dial hook is not used for HTTPS
	// requests and the TLSClientConfig and TLSHandshakeTimeout
	// are ignored. The returned net.Conn is assumed to already be
	// past the TLS handshake.
	DialTLS func(network, addr string) (net.Conn, error)

	// TLSClientConfig specifies the TLS configuration to use with
	// tls.Client. If nil, the default configuration is used.
	TLSClientConfig *tls.Config

	// TLSHandshakeTimeout specifies the maximum amount of time waiting to
	// wait for a TLS handshake. Zero means no timeout.
	TLSHandshakeTimeout time.Duration

	// DisableKeepAlives, if true, prevents re-use of TCP connections
	// between different HTTP requests.
	DisableKeepAlives bool

	// DisableCompression, if true, prevents the Transport from
	// requesting compression with an "Accept-Encoding: gzip"
	// request header when the Request contains no existing
	// Accept-Encoding value. If the Transport requests gzip on
	// its own and gets a gzipped response, it's transparently
	// decoded in the Response.Body. However, if the user
	// explicitly requested gzip it is not automatically
	// uncompressed.
	DisableCompression bool

	// MaxIdleConnsPerHost, if non-zero, controls the maximum idle
	// (keep-alive) to keep per-host.  If zero,
	// DefaultMaxIdleConnsPerHost is used.
	MaxIdleConnsPerHost int

	// ResponseHeaderTimeout, if non-zero, specifies the amount of
	// time to wait for a server's response headers after fully
	// writing the request (including its body, if any). This
	// time does not include the time to read the response body.
	ResponseHeaderTimeout time.Duration
	// contains filtered or unexported fields

Transport is an implementation of RoundTripper that supports HTTP, HTTPS, and HTTP proxies (for either HTTP or HTTPS with CONNECT). Transport can also cache connections for future re-use.

func NewTransport added in v0.5.3

func NewTransport(info transport.TLSInfo) (*Transport, error)

func (*Transport) CancelRequest added in v0.5.3

func (t *Transport) CancelRequest(req *http.Request)

CancelRequest cancels an in-flight request by closing its connection. CancelRequest should only be called after RoundTrip has returned.

func (*Transport) CloseIdleConnections added in v0.5.3

func (t *Transport) CloseIdleConnections()

CloseIdleConnections closes any connections which were previously connected from previous requests but are now sitting idle in a "keep-alive" state. It does not interrupt any connections currently in use.

func (*Transport) RegisterProtocol added in v0.5.3

func (t *Transport) RegisterProtocol(scheme string, rt http.RoundTripper)

RegisterProtocol registers a new protocol with scheme. The Transport will pass requests using the given scheme to rt. It is rt's responsibility to simulate HTTP request semantics.

RegisterProtocol can be used by other packages to provide implementations of protocol schemes like "ftp" or "file".

func (*Transport) RoundTrip added in v0.5.3

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip implements the RoundTripper interface.

For higher-level HTTP client support (such as handling of cookies and redirects), see Get, Post, and the Client type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL