core

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageMethodData = iota
	MessageMethodDial
)

Variables

This section is empty.

Functions

func GenP256 added in v0.2.2

func GenP256(hosts []string) (key, cert []byte, err error)

Modified https://github.com/Shyp/generate-tls-cert

func GenRSA2048 added in v0.3.0

func GenRSA2048(hosts []string) (key, cert []byte, err error)

func NewHostHeader added in v0.11.1

func NewHostHeader(host string) (header map[string][]string)

Types

type Message added in v0.8.0

type Message struct {
	Method    byte
	ConnID    uint64
	MessageID uint64
	Data      []byte
}

type MuxConn added in v0.8.0

type MuxConn struct {
	ID    uint64
	MuxWS *MuxWebSocket
	// contains filtered or unexported fields
}

func NewMuxConn added in v0.8.0

func NewMuxConn(muxWS *MuxWebSocket) (conn *MuxConn)

NewMuxConn create new mux connection for client

func (*MuxConn) DialMessage added in v0.8.0

func (conn *MuxConn) DialMessage(host string) (err error)

client dial remote

func (*MuxConn) HandleMessage added in v0.8.0

func (conn *MuxConn) HandleMessage(m *Message) (err error)

func (*MuxConn) Read added in v0.8.0

func (conn *MuxConn) Read(p []byte) (n int, err error)

func (*MuxConn) Run added in v0.8.0

func (conn *MuxConn) Run(c *net.TCPConn)

func (*MuxConn) SendMessageID added in v0.8.0

func (conn *MuxConn) SendMessageID() (id uint64)

func (*MuxConn) Write added in v0.8.0

func (conn *MuxConn) Write(p []byte) (n int, err error)

type MuxWebSocket added in v0.8.0

type MuxWebSocket struct {
	*WebSocket
	Decoder *gob.Decoder
	Encoder *gob.Encoder
	// contains filtered or unexported fields
}

func NewMuxWebSocket added in v0.8.0

func NewMuxWebSocket(ws *WebSocket) (muxWS *MuxWebSocket)

func (*MuxWebSocket) GetMuxConn added in v0.8.0

func (muxWS *MuxWebSocket) GetMuxConn(connID uint64) (conn *MuxConn)

func (*MuxWebSocket) PutMuxConn added in v0.8.0

func (muxWS *MuxWebSocket) PutMuxConn(conn *MuxConn)

func (*MuxWebSocket) ReceiveMessage added in v0.8.0

func (muxWS *MuxWebSocket) ReceiveMessage() (m *Message, err error)

func (*MuxWebSocket) SendMessage added in v0.8.0

func (muxWS *MuxWebSocket) SendMessage(m *Message) (err error)

type Stats added in v0.12.1

type Stats struct {
	Downloaded    uint64
	DownloadSpeed uint64

	Uploaded    uint64
	UploadSpeed uint64
	// contains filtered or unexported fields
}

func NewStats added in v0.12.1

func NewStats() (stats *Stats)

func (*Stats) AddDownloaded added in v0.12.1

func (stats *Stats) AddDownloaded(downloaded uint64)

func (*Stats) AddUploaded added in v0.12.1

func (stats *Stats) AddUploaded(uploaded uint64)

type WebSocket added in v0.6.0

type WebSocket struct {
	// contains filtered or unexported fields
}

func NewWebSocket added in v0.10.1

func NewWebSocket(conn *websocket.Conn, stats *Stats) (ws *WebSocket)

func (*WebSocket) Close added in v0.8.0

func (ws *WebSocket) Close() (err error)

func (*WebSocket) Read added in v0.6.0

func (ws *WebSocket) Read(p []byte) (n int, err error)

func (*WebSocket) Write added in v0.6.0

func (ws *WebSocket) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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