transport

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TLSConfig = &tls.Config{MinVersion: tls.VersionTLS13, InsecureSkipVerify: false}
View Source
var TLSSkipConfig = &tls.Config{MinVersion: tls.VersionTLS13, InsecureSkipVerify: true}

Functions

func CacheConfig

func CacheConfig(id string, cfg *Config)

func Dial

func Dial(point *xnet.Point) (conn net.Conn, err error)

func NewDefaultHttpDialer

func NewDefaultHttpDialer(fn TakerFn) *defaultHttpDialer

func NewServeConn

func NewServeConn(w http.ResponseWriter, r *http.Request) (conn net.Conn, err error)

func RegDialFn

func RegDialFn(name string, fn DialFn) error

func RegServerFn

func RegServerFn(name string, fn ServerFn) error

func RemoveConfig

func RemoveConfig(id string)

Types

type ClientConn

type ClientConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewClientConn

func NewClientConn(pr *io.PipeReader, pw *io.PipeWriter, r io.ReadCloser, client *http.Client) *ClientConn

func (ClientConn) Close

func (c ClientConn) Close() error

func (ClientConn) Read

func (c ClientConn) Read(b []byte) (int, error)

func (ClientConn) SetDeadline

func (c ClientConn) SetDeadline(t time.Time) error

func (ClientConn) SetReadDeadline

func (c ClientConn) SetReadDeadline(t time.Time) error

func (ClientConn) SetWriteDeadline

func (c ClientConn) SetWriteDeadline(t time.Time) error

func (ClientConn) Write

func (c ClientConn) Write(b []byte) (int, error)

type CloserServer

type CloserServer struct {
	io.Closer
}

func (CloserServer) Close

func (s CloserServer) Close() error

func (CloserServer) Listen

func (s CloserServer) Listen(p *xnet.Point, handle Handle) (err error)

type Config

type Config struct {
	Taker
	TLSConfig *tls.Config
	Schema    string
	URL       *url.URL
	Client    *http.Client
	Error     error
}

func GetConfig

func GetConfig(id string) (cfg *Config)

func NewConfig

func NewConfig(p *xnet.Point, t Taker) *Config

type DialFn

type DialFn func(point *xnet.Point) (conn net.Conn, err error)

type Dialer

type Dialer interface {
	Dial(p *xnet.Point) (conn net.Conn, err error)
}

type DialerFn

type DialerFn func(point *xnet.Point) (d Dialer)

type Handle

type Handle func(conn net.Conn)

type HandleUDP

type HandleUDP func(conn *net.UDPConn, b []byte, addr *net.UDPAddr) (err error)

type Handler

type Handler interface {
	Handle(conn net.Conn)
}

type HttpDialer

type HttpDialer interface {
	GetConfig(p *xnet.Point) *Config
	Dial(p *xnet.Point) (conn net.Conn, err error)
}

type HttpTaker

type HttpTaker xnet.Point

func NewHttpTaker

func NewHttpTaker(p xnet.Point) *HttpTaker

func (HttpTaker) Do

func (t HttpTaker) Do(req *http.Request, cfg *Config) (*http.Response, error)

func (*HttpTaker) GetSchema

func (t *HttpTaker) GetSchema() string

func (HttpTaker) GetTLSConfig

func (t HttpTaker) GetTLSConfig() *tls.Config

func (HttpTaker) NewClient

func (t HttpTaker) NewClient(cfg *tls.Config) *http.Client

func (HttpTaker) NewRequest

func (t HttpTaker) NewRequest(u *url.URL) *http.Request

func (HttpTaker) NewURL

func (t HttpTaker) NewURL(schema string) *url.URL

type ServeConn

type ServeConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (ServeConn) Close

func (s ServeConn) Close() error

func (ServeConn) Read

func (s ServeConn) Read(b []byte) (int, error)

func (ServeConn) SetDeadline added in v0.9.3

func (s ServeConn) SetDeadline(t time.Time) error

func (ServeConn) SetReadDeadline added in v0.9.3

func (s ServeConn) SetReadDeadline(t time.Time) error

func (ServeConn) SetWriteDeadline added in v0.9.3

func (s ServeConn) SetWriteDeadline(t time.Time) error

func (ServeConn) Write

func (s ServeConn) Write(b []byte) (n int, err error)

type Server

type Server interface {
	Listen(p *xnet.Point, handle Handle) (err error)
	Close() error
}

func NewServer

func NewServer(transport string) (svr Server, err error)

type ServerFn

type ServerFn func() (srv Server)

type Taker

type Taker interface {
	GetTLSConfig() *tls.Config
	NewClient(cfg *tls.Config) *http.Client
	NewRequest(u *url.URL) *http.Request
	GetSchema() string
	NewURL(schema string) *url.URL
	Do(req *http.Request, cfg *Config) (*http.Response, error)
}

func NewTaker

func NewTaker(p xnet.Point) Taker

type TakerFn

type TakerFn func(p xnet.Point) Taker

type UDPHandler

type UDPHandler interface {
	HandleUDP(conn net.UDPConn, b []byte, addr *net.UDPAddr) (err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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