common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: LGPL-3.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ProxyServerTcp       string = "tcp"
	ProxyServerWebsocket string = "websocket"
)
View Source
const (
	CommandLoad        string = "load"
	CommandUpdate      string = "update"
	CommandConnect     string = "connect"
	CommandFingerprint string = "fingerprint"
)
View Source
const (
	StatusConnecting   string = "connecting"
	StatusConnected    string = "connected"
	StatusDisconnected string = "disconnected"
)

Variables

This section is empty.

Functions

func RegisterProxyServer added in v1.1.0

func RegisterProxyServer(serverType string, server IProxyServer)

Types

type Client added in v1.1.0

type Client struct {
	Ch   ClientHandler
	Host string
	Port int
	Uuid string
	Conn *net.TCPConn
}

func NewClient added in v1.1.0

func NewClient(host string, port int, uuid string, ch ClientHandler) (*Client, error)

func (*Client) Close added in v1.1.0

func (c *Client) Close()

func (*Client) Write added in v1.1.0

func (c *Client) Write(buffer []byte)

type ClientHandler added in v1.1.0

type ClientHandler interface {
	OnClientDisconnected(c *Client)
	OnClientRead(c *Client, buffer []byte)
}

type ConnectionRequest

type ConnectionRequest struct {
	Request
	Data Server `json:"data"`
}

type ConnectionResponse

type ConnectionResponse struct {
	Response
	RequestData Server `json:"request"`
}

type FingerprintResponse added in v1.1.0

type FingerprintResponse struct {
	Response
	Data string `json:"data"`
}

type IProxyServer added in v1.1.0

type IProxyServer interface {
	Open(s *ProxyServer, h IProxyServerHandler, fingerprint string) error
	Close()
	Write(uuid string, buffer []byte) error
	CloseConnection(uuid string) error
	Fingerprint() string
	SetServer(server Server)
	Server() Server
	Port() int
}

func NewProxyServer added in v1.1.0

func NewProxyServer(serverType string, s *ProxyServer, h IProxyServerHandler, fingerprint string) (IProxyServer, error)

type IProxyServerHandler added in v1.1.0

type IProxyServerHandler interface {
	OnNewConnection(p IProxyServer, uuid string)
	OnDisconnected(p IProxyServer, uuid string)
	OnRead(p IProxyServer, uuid string, buffer []byte)
}

type LoadResponse

type LoadResponse struct {
	Response
	Data []Server `json:"data"`
}

type ProxyServer

type ProxyServer struct {
	Server
	Fingerprint string `json:"fingerprint"`
	ProxyPort   int    `json:"proxyPort"`
}

type Request

type Request struct {
	Command string `json:"command"`
	Session int    `json:"session"`
}

type Response

type Response struct {
	Request
	Result bool   `json:"result"`
	Error  string `json:"error"`
}

type Server

type Server struct {
	Uuid        string   `json:"uuid"`
	Host        string   `json:"host"`
	Port        int      `json:"port"`
	Description string   `json:"description"`
	Type        string   `json:"type"`
	IsPublic    bool     `json:"isPublic"`
	WhiteList   []string `json:"whiteList"`
}

Jump to

Keyboard shortcuts

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