tcp

package
v0.0.0-...-3b4426b Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCommand = struct {
	//heartbeat
	HEARTBEAT_REQUEST  Command //client send heartbeat packet to server
	HEARTBEAT_RESPONSE Command //server response heartbeat packet of client

	//handshake
	HELLO_REQUEST  Command //client send handshake request to server
	HELLO_RESPONSE Command //server response handshake request of client

	//disconnection
	CLIENT_GOODBYE_REQUEST  Command //Notify server when client actively disconnects
	CLIENT_GOODBYE_RESPONSE Command //Server replies to client's active disconnection notification
	SERVER_GOODBYE_REQUEST  Command //Notify client when server actively disconnects
	SERVER_GOODBYE_RESPONSE Command //Client replies to server's active disconnection notification

	//subscription management
	SUBSCRIBE_REQUEST    Command //Subscription request sent by client to server
	SUBSCRIBE_RESPONSE   Command //Server replies to client's subscription request
	UNSUBSCRIBE_REQUEST  Command //Unsubscribe request from client to server
	UNSUBSCRIBE_RESPONSE Command //Server replies to client's unsubscribe request

	//monitor
	LISTEN_REQUEST  Command //Request from client to server to start topic listening
	LISTEN_RESPONSE Command //The server replies to the client's listening request

	//RR
	REQUEST_TO_SERVER      Command //The client sends the RR request to the server
	REQUEST_TO_CLIENT      Command //The server pushes the RR request to the client
	REQUEST_TO_CLIENT_ACK  Command //After receiving RR request, the client sends ACK to the server
	RESPONSE_TO_SERVER     Command //The client sends the RR packet back to the server
	RESPONSE_TO_CLIENT     Command //The server pushes the RR packet back to the client
	RESPONSE_TO_CLIENT_ACK Command //After receiving the return packet, the client sends ACK to the server

	//Asynchronous events
	ASYNC_MESSAGE_TO_SERVER     Command //The client sends asynchronous events to the server
	ASYNC_MESSAGE_TO_SERVER_ACK Command //After receiving the asynchronous event, the server sends ack to the client
	ASYNC_MESSAGE_TO_CLIENT     Command //The server pushes asynchronous events to the client
	ASYNC_MESSAGE_TO_CLIENT_ACK Command //After the client receives the asynchronous event, the ACK is sent to the server

	//radio broadcast
	BROADCAST_MESSAGE_TO_SERVER     Command //The client sends the broadcast message to the server
	BROADCAST_MESSAGE_TO_SERVER_ACK Command //After receiving the broadcast message, the server sends ACK to the client
	BROADCAST_MESSAGE_TO_CLIENT     Command //The server pushes the broadcast message to the client
	BROADCAST_MESSAGE_TO_CLIENT_ACK Command //After the client receives the broadcast message, the ACK is sent to the server

	//Log reporting
	SYS_LOG_TO_LOGSERVER Command //Business log reporting

	//RMB tracking log reporting
	TRACE_LOG_TO_LOGSERVER Command //RMB tracking log reporting

	//Redirecting instruction
	REDIRECT_TO_CLIENT Command //The server pushes the redirection instruction to the client

	//service register
	REGISTER_REQUEST  Command //Client sends registration request to server
	REGISTER_RESPONSE Command //The server sends the registration result to the client

	//service unregister
	UNREGISTER_REQUEST  Command //The client sends a de registration request to the server
	UNREGISTER_RESPONSE Command //The server will register the result to the client

	//The client asks which EventMesh to recommend
	RECOMMEND_REQUEST  Command //Client sends recommendation request to server
	RECOMMEND_RESPONSE Command //The server will recommend the results to the client
}{

	HEARTBEAT_REQUEST:  "HEARTBEAT_REQUEST",
	HEARTBEAT_RESPONSE: "HEARTBEAT_RESPONSE",

	HELLO_REQUEST:  "HELLO_REQUEST",
	HELLO_RESPONSE: "HELLO_RESPONSE",

	CLIENT_GOODBYE_REQUEST:  "CLIENT_GOODBYE_REQUEST",
	CLIENT_GOODBYE_RESPONSE: "CLIENT_GOODBYE_RESPONSE",
	SERVER_GOODBYE_REQUEST:  "SERVER_GOODBYE_REQUEST",
	SERVER_GOODBYE_RESPONSE: "SERVER_GOODBYE_RESPONSE",

	SUBSCRIBE_REQUEST:    "SUBSCRIBE_REQUEST",
	SUBSCRIBE_RESPONSE:   "SUBSCRIBE_RESPONSE",
	UNSUBSCRIBE_REQUEST:  "UNSUBSCRIBE_REQUEST",
	UNSUBSCRIBE_RESPONSE: "UNSUBSCRIBE_RESPONSE",

	LISTEN_REQUEST:  "LISTEN_REQUEST",
	LISTEN_RESPONSE: "LISTEN_RESPONSE",

	REQUEST_TO_SERVER:      "REQUEST_TO_SERVER",
	REQUEST_TO_CLIENT:      "REQUEST_TO_CLIENT",
	REQUEST_TO_CLIENT_ACK:  "REQUEST_TO_CLIENT_ACK",
	RESPONSE_TO_SERVER:     "RESPONSE_TO_SERVER",
	RESPONSE_TO_CLIENT:     "RESPONSE_TO_CLIENT",
	RESPONSE_TO_CLIENT_ACK: "RESPONSE_TO_CLIENT_ACK",

	ASYNC_MESSAGE_TO_SERVER:     "ASYNC_MESSAGE_TO_SERVER",
	ASYNC_MESSAGE_TO_SERVER_ACK: "ASYNC_MESSAGE_TO_SERVER_ACK",
	ASYNC_MESSAGE_TO_CLIENT:     "ASYNC_MESSAGE_TO_CLIENT",
	ASYNC_MESSAGE_TO_CLIENT_ACK: "ASYNC_MESSAGE_TO_CLIENT_ACK",

	BROADCAST_MESSAGE_TO_SERVER:     "BROADCAST_MESSAGE_TO_SERVER",
	BROADCAST_MESSAGE_TO_SERVER_ACK: "BROADCAST_MESSAGE_TO_SERVER_ACK",
	BROADCAST_MESSAGE_TO_CLIENT:     "BROADCAST_MESSAGE_TO_CLIENT",
	BROADCAST_MESSAGE_TO_CLIENT_ACK: "BROADCAST_MESSAGE_TO_CLIENT_ACK",

	SYS_LOG_TO_LOGSERVER: "SYS_LOG_TO_LOGSERVER",

	TRACE_LOG_TO_LOGSERVER: "TRACE_LOG_TO_LOGSERVER",

	REDIRECT_TO_CLIENT: "REDIRECT_TO_CLIENT",

	REGISTER_REQUEST:  "REGISTER_REQUEST",
	REGISTER_RESPONSE: "REGISTER_RESPONSE",

	UNREGISTER_REQUEST:  "UNREGISTER_REQUEST",
	UNREGISTER_RESPONSE: "UNREGISTER_RESPONSE",

	RECOMMEND_REQUEST:  "RECOMMEND_REQUEST",
	RECOMMEND_RESPONSE: "RECOMMEND_RESPONSE",
}

Functions

This section is empty.

Types

type Command

type Command string
type Header struct {
	Cmd        Command                `json:"cmd"`
	Code       int                    `json:"code"`
	Desc       string                 `json:"desc"`
	Seq        string                 `json:"seq"`
	Properties map[string]interface{} `json:"properties"`
}

func NewHeader

func NewHeader(cmd Command, code int, desc string, seq string) Header

func (Header) GetProperty

func (h Header) GetProperty(name string) interface{}

func (Header) Marshal

func (h Header) Marshal() []byte

func (Header) PutProperty

func (h Header) PutProperty(name string, value interface{})

func (Header) Unmarshal

func (h Header) Unmarshal(header []byte) Header

type Package

type Package struct {
	Header Header      `json:"header"`
	Body   interface{} `json:"body"`
}

func NewPackage

func NewPackage(header Header) Package

type UserAgent

type UserAgent struct {
	Env       string `json:"env"`
	Subsystem string `json:"subsystem"`
	Path      string `json:"path"`
	Pid       int    `json:"pid"`
	Host      string `json:"host"`
	Port      int    `json:"port"`
	Version   string `json:"version"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Idc       string `json:"idc"`
	Group     string `json:"group"`
	Purpose   string `json:"purpose"`
	Unack     int    `json:"unack"`
}

func NewUserAgent

func NewUserAgent(env string, subsystem string, path string, pid int, host string, port int, version string,
	username string, password string, idc string, producerGroup string, consumerGroup string) *UserAgent

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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