protocol

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgsForNewConnectionFromUser

type ArgsForNewConnectionFromUser struct {
	Name string `json:"name"` // 服务名
}

type ArgsForRegisterAsProxy

type ArgsForRegisterAsProxy struct {
	ID string `json:"string"` // 等于请求的command.ID
}

type ArgsForRegisterService

type ArgsForRegisterService struct {
	conf.ServiceConfig
}

注册service

type ArgsNewConnectionFromClient

type ArgsNewConnectionFromClient struct {
	ID string `json:"id"` // 响应请求ID
}

type Command

type Command struct {
	ID      string      `json:"id,omitempty"`
	Command CommandType `json:"cmd"`
	Args    []byte      `json:"args,omitempty"`
}

type CommandType

type CommandType uint32
const (
	Noop                  CommandType = iota
	RegisterAsControl                 // xlan-c 向 xlan-s 建立连接, 标记自己身份为控制连接
	RegisterAsProxy                   // xlan-c 向 xlan-s 建立连接, 标记自己身份为代理连接
	RegisterService                   // xlan-c向xlan-s注册服务
	NewConnectionFromUser             // xlan-s 向 xlan-c 发送命令, 告知有新的 user 请求
)

func (CommandType) String

func (ct CommandType) String() string

type Wire

type Wire struct {
}

func NewWire

func NewWire() *Wire

func (*Wire) ReadCommand

func (w *Wire) ReadCommand(conn net.Conn) (*Command, error)

func (*Wire) WriteCommand

func (w *Wire) WriteCommand(conn net.Conn, command *Command, args ...interface{}) error

Jump to

Keyboard shortcuts

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