jsonmsg

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRequest = "request" // Main to sub
	TypeResult  = "result"  // Sub to main

)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigureRequestArgs

type ConfigureRequestArgs struct {
	Me       net.IP        `json:"me"` // Required
	Forwards []Forward     `json:"forwards,omitempty"`
	Others   []IPPortProto `json:"others,omitempty"`
}

type ConfigureResultData

type ConfigureResultData struct {
	Features []version.Feature `json:"features,omitempty"`
	Version  string            `json:"version,omitempty"`
}

type Forward

type Forward struct {
	// listenIP is "me"
	ListenPort  uint16 `json:"listen_port"`
	ConnectIP   net.IP `json:"connect_ip"`
	ConnectPort uint16 `json:"connect_port"`
	Proto       string `json:"proto"`
}

type IPPortProto

type IPPortProto struct {
	IP    net.IP `json:"ip"`
	Port  uint16 `json:"port"`
	Proto string `json:"proto"`
}

type Message

type Message struct {
	Type Type            `json:"type"` // Required
	Body json.RawMessage `json:"body"` // Request or Result
}

type Op

type Op = string
const (
	OpConfigure Op = "configure"
)

type Request

type Request struct {
	ID   int             `json:"id"` // Required
	Op   Op              `json:"op"` // Required
	Args json.RawMessage `json:"args,omitempty"`
}

type Result

type Result struct {
	RequestID int             `json:"request_id"` // Required
	Op        Op              `json:"op"`         // Required
	Error     json.RawMessage `json:"error,omitempty"`
	Data      json.RawMessage `json:"data,omitempty"`
}

type Type

type Type = string

Jump to

Keyboard shortcuts

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