jsonmsg

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 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 {
	// Fields added in v0.2.0
	Me       net.IP        `json:"me"` // Required
	Forwards []Forward     `json:"forwards,omitempty"`
	Others   []IPPortProto `json:"others,omitempty"`
	// Fields added in v0.4.0
	HostnameMap   map[string]net.IP `json:"hostnameMap,omitempty"` // hostname -> ip
	HTTP          HTTP              `json:"http,omitempty"`
	SOCKS         SOCKS             `json:"socks,omitempty"`
	Loopback      Loopback          `json:"loopback,omitempty"`
	StateDir      StateDir          `json:"stateDir,omitempty"`
	WriteEtcHosts bool              `json:"writeEtcHosts,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 HTTP added in v0.4.0

type HTTP struct {
	Listen string `json:"listen,omitempty"`
}

type IPPortProto

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

type Loopback added in v0.4.0

type Loopback struct {
	Disable bool `json:"disable,omitempty"`
}

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 SOCKS added in v0.4.0

type SOCKS struct {
	Listen string `json:"listen,omitempty"`
}

type StateDir added in v0.4.0

type StateDir struct {
	Path    string `json:"path,omitempty"`
	Disable bool   `json:"disable,omitempty"`
}

type Type

type Type = string

Jump to

Keyboard shortcuts

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