generic

package
v0.0.0-...-6a6390e Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MuxAdapter

type MuxAdapter interface {
	AdaptServer(net.Conn) (pipe.Conn, error)
	AdaptClient(net.Conn) (pipe.Conn, error)
}

MuxAdapter can adapt a go net.Conn into a pipe.Conn

type MuxConfig

type MuxConfig struct{ *yamux.Config }

MuxConfig is a MuxAdapter that uses github.com/hashicorp/yamux

func (MuxConfig) AdaptClient

func (c MuxConfig) AdaptClient(conn net.Conn) (pipe.Conn, error)

AdaptClient is called by the dialer

func (MuxConfig) AdaptServer

func (c MuxConfig) AdaptServer(conn net.Conn) (pipe.Conn, error)

AdaptServer is called by the listener

type NetDialer

type NetDialer interface {
	DialContext(c context.Context, network, address string) (net.Conn, error)
}

NetDialer can produce a standard library Dialer

type NetListener

type NetListener interface {
	Listen(c context.Context, network, address string) (net.Listener, error)
}

NetListener can produce a standard library Listener

type Option

type Option func(*Transport) (prev Option)

Option for TCP transport

func OptDialer

func OptDialer(d NetDialer) Option

OptDialer sets the dialer

func OptListener

func OptListener(l NetListener) Option

OptListener sets the ListenConfig

func OptMuxAdapter

func OptMuxAdapter(x MuxAdapter) Option

OptMuxAdapter sets the muxer

type Transport

type Transport struct {
	MuxAdapter
	NetListener
	NetDialer
}

Transport for any pipe.Conn

func New

func New(opt ...Option) (t Transport)

New Generic Transport

func (Transport) Dial

func (t Transport) Dial(c context.Context, a net.Addr) (pipe.Conn, error)

Dial Generic

func (Transport) Listen

func (t Transport) Listen(c context.Context, a net.Addr) (pipe.Listener, error)

Listen Generic

Jump to

Keyboard shortcuts

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