jsonmsg

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeRequest = "request" // Manager -> Agent
	TypeResult  = "result"  // Manager <- Agent, always tied with a request
	TypeEvent   = "event"   // Manager <- Agent, untied with a request
)

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"`
	// Fields added in v0.5.0
	Routes      []Route      `json:"routes,omitempty"`
	NameServers []NameServer `json:"nameServers,omitempty"`
}

type ConfigureResultData

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

type Event added in v0.5.0

type Event struct {
	Type EventType       `json:"type"` // Required
	Data json.RawMessage `json:"data,omitempty"`
}

type EventType added in v0.5.0

type EventType = string
const (
	EventTypeRouteSuggestion EventType = "routeSuggestion"
)

type Forward

type Forward struct {
	// listenIP is "me"
	ListenPort uint16 `json:"listen_port"`
	// ConnectIP can be either IP or hostname.
	// Until NoRouter v0.4.0, it had to be IP.
	// The field name stil contains "_ip" suffix for compatibility.
	ConnectIP   string `json:"connect_ip"`
	ConnectPort uint16 `json:"connect_port"`
	Proto       string `json:"proto"`
}

Forward uses snake_case rather than camelCase by accident :(

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 NameServer added in v0.5.0

type NameServer struct {
	IPPortProto
}

NameServer represents a built-in virtual DNS

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 Route added in v0.5.0

type Route struct {
	ToCIDR         []string `json:"toCIDR"`         // e.g. "192.168.95.0/24"
	ToHostnameGlob []string `json:"toHostnameGlob"` // e.g. "*.cloud1.example.com"
	Via            net.IP   `json:"via"`
}

type RouteSuggestionEventData added in v0.5.0

type RouteSuggestionEventData struct {
	IP    []net.IP `json:"ip,omitempty"`
	Route net.IP   `json:"route,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