channels

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Channels = hyper.ChannelDefinitions{
	"stdout": hyper.ChannelDefinition{
		Name:              "Stdout Channel",
		Description:       "Prints messages to stdout (just for testing and debugging)",
		Maker:             MakeStdoutChannel,
		SettingsValidator: StdoutSettingsValidator,
	},
	"jsonrpc_client": hyper.ChannelDefinition{
		Name:              "JSONRPC Client Channel",
		Description:       "Creates outgoing JSONRPC connections to deliver and receive messages",
		Maker:             MakeJSONRPCClientChannel,
		SettingsValidator: JSONRPCClientSettingsValidator,
	},
	"grpc_client": hyper.ChannelDefinition{
		Name:              "gRPC Client Channel",
		Description:       "Creates outgoing gRPC connections to deliver and receive messages",
		Maker:             MakeGRPCClientChannel,
		SettingsValidator: GRPCClientSettingsValidator,
	},
	"jsonrpc_server": hyper.ChannelDefinition{
		Name:              "JSONRPC Server Channel",
		Description:       "Accepts incoming JSONRPC connections to deliver and receive messages",
		Maker:             MakeJSONRPCServerChannel,
		SettingsValidator: JSONRPCServerSettingsValidator,
	},
	"grpc_server": hyper.ChannelDefinition{
		Name:              "gRPC Server Channel",
		Description:       "Accepts incoming gRPC connections to deliver and receive messages",
		Maker:             MakeGRPCServerChannel,
		SettingsValidator: GRPCServerSettingsValidator,
	},
	"quic": hyper.ChannelDefinition{
		Name:              "QUIC Channel",
		Description:       "Uses QUIC to forward traffic between peers",
		Maker:             MakeQUICChannel,
		SettingsValidator: QUICSettingsValidator,
	},
}
View Source
var GRPCServerEntrySettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "address",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "internal",
			Validators: []forms.Validator{
				forms.IsOptional{Default: false},
				forms.IsBoolean{},
			},
		},
		{
			Name: "proxy",
			Validators: []forms.Validator{
				forms.IsOptional{Default: ""},
				forms.IsString{},
			},
		},
	},
}
View Source
var QUICChannelForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "remote",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &QUICRemoteForm,
				},
			},
		},
		{
			Name: "local",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &QUICLocalForm,
				},
			},
		},
	},
}
View Source
var QUICChannelSettingsForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "address",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var QUICForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "tls",
			Validators: []forms.Validator{
				forms.IsStringMap{
					Form: &tls.TLSSettingsForm,
				},
			},
		},
		{
			Name: "bindAddress",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "channels",
			Validators: []forms.Validator{
				forms.IsList{
					Validators: []forms.Validator{
						forms.IsStringMap{
							Form: &QUICChannelForm,
						},
					},
				},
			},
		},
	},
}
View Source
var QUICLocalForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "port",
			Validators: []forms.Validator{
				forms.IsInteger{
					HasMin: true,
					Min:    1,
					HasMax: true,
					Max:    65535,
				},
			},
		},
		{
			Name: "host",
			Validators: []forms.Validator{
				forms.IsOptional{Default: "0.0.0.0"},
				forms.IsString{},
			},
		},
	},
}
View Source
var QUICRemoteForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "host",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
		{
			Name: "port",
			Validators: []forms.Validator{
				forms.IsInteger{
					HasMin: true,
					Min:    1,
					HasMax: true,
					Max:    65535,
				},
			},
		},
	},
}
View Source
var RequestConnectionResponseForm = forms.Form{
	Fields: []forms.Field{
		{
			Name: "token",
			Validators: []forms.Validator{
				forms.IsBytes{Encoding: "base64"},
			},
		},
		{
			Name: "endpoint",
			Validators: []forms.Validator{
				forms.IsString{},
			},
		},
	},
}
View Source
var StdoutSettingsForm = forms.Form{
	Fields: []forms.Field{},
}

Functions

func GRPCClientSettingsValidator

func GRPCClientSettingsValidator(settings map[string]interface{}) (interface{}, error)

func GRPCServerSettingsValidator

func GRPCServerSettingsValidator(settings map[string]interface{}) (interface{}, error)

func JSONRPCClientSettingsValidator

func JSONRPCClientSettingsValidator(settings map[string]interface{}) (interface{}, error)

func JSONRPCServerSettingsValidator

func JSONRPCServerSettingsValidator(settings map[string]interface{}) (interface{}, error)

func MakeGRPCClientChannel

func MakeGRPCClientChannel(settings interface{}) (hyper.Channel, error)

func MakeGRPCServerChannel

func MakeGRPCServerChannel(settings interface{}) (hyper.Channel, error)

func MakeJSONRPCClientChannel

func MakeJSONRPCClientChannel(settings interface{}) (hyper.Channel, error)

func MakeJSONRPCServerChannel

func MakeJSONRPCServerChannel(settings interface{}) (hyper.Channel, error)

func MakeQUICChannel added in v0.3.1

func MakeQUICChannel(settings interface{}) (hyper.Channel, error)

func MakeStdoutChannel

func MakeStdoutChannel(settings interface{}) (hyper.Channel, error)

func QUICSettingsValidator added in v0.3.1

func QUICSettingsValidator(settings map[string]interface{}) (interface{}, error)

func StdoutSettingsValidator

func StdoutSettingsValidator(settings map[string]interface{}) (interface{}, error)

Types

type GRPCClientChannel

type GRPCClientChannel struct {
	hyper.BaseChannel
	Settings grpc.GRPCClientSettings
	// contains filtered or unexported fields
}

func (*GRPCClientChannel) CanDeliverTo

func (c *GRPCClientChannel) CanDeliverTo(address *hyper.Address) bool

func (*GRPCClientChannel) Close

func (c *GRPCClientChannel) Close() error

func (*GRPCClientChannel) DeliverRequest

func (c *GRPCClientChannel) DeliverRequest(request *hyper.Request) (*hyper.Response, error)

func (*GRPCClientChannel) HandleRequest

func (c *GRPCClientChannel) HandleRequest(request *hyper.Request, clientInfo *hyper.ClientInfo) (*hyper.Response, error)

func (*GRPCClientChannel) Open

func (c *GRPCClientChannel) Open() error

func (*GRPCClientChannel) Type

func (c *GRPCClientChannel) Type() string

type GRPCServerChannel

type GRPCServerChannel struct {
	hyper.BaseChannel

	Settings grpc.GRPCServerSettings
	// contains filtered or unexported fields
}

func (*GRPCServerChannel) CanDeliverTo

func (c *GRPCServerChannel) CanDeliverTo(address *hyper.Address) bool

func (*GRPCServerChannel) Close

func (c *GRPCServerChannel) Close() error

func (*GRPCServerChannel) DeliverRequest

func (c *GRPCServerChannel) DeliverRequest(request *hyper.Request) (*hyper.Response, error)

func (*GRPCServerChannel) HandleConnectionRequest

func (c *GRPCServerChannel) HandleConnectionRequest(address *hyper.Address, request *hyper.Request) (*hyper.Response, error)

func (*GRPCServerChannel) HandleRequest

func (c *GRPCServerChannel) HandleRequest(request *hyper.Request, clientInfo *hyper.ClientInfo) (*hyper.Response, error)

func (*GRPCServerChannel) Open

func (c *GRPCServerChannel) Open() error

func (*GRPCServerChannel) Type

func (c *GRPCServerChannel) Type() string

type GRPCServerConnection

type GRPCServerConnection struct {
	Name    string
	Address string
	Stale   bool
	// contains filtered or unexported fields
}

func (*GRPCServerConnection) Close

func (c *GRPCServerConnection) Close() error

func (*GRPCServerConnection) Open

func (c *GRPCServerConnection) Open() error

type GRPCServerEntrySettings

type GRPCServerEntrySettings struct {
	Address  string `json:"address"`
	Internal bool   `json:"internal"`
	Proxy    string `json:"proxy"`
}

type JSONRPCClientChannel

type JSONRPCClientChannel struct {
	hyper.BaseChannel
	Settings *jsonrpc.JSONRPCClientSettings
}

func (*JSONRPCClientChannel) CanDeliverTo

func (c *JSONRPCClientChannel) CanDeliverTo(address *hyper.Address) bool

func (*JSONRPCClientChannel) Close

func (c *JSONRPCClientChannel) Close() error

func (*JSONRPCClientChannel) DeliverRequest

func (c *JSONRPCClientChannel) DeliverRequest(request *hyper.Request) (*hyper.Response, error)

func (*JSONRPCClientChannel) Open

func (c *JSONRPCClientChannel) Open() error

func (*JSONRPCClientChannel) Type

func (c *JSONRPCClientChannel) Type() string

type JSONRPCServerChannel

type JSONRPCServerChannel struct {
	hyper.BaseChannel
	Settings *jsonrpc.JSONRPCServerSettings
	Server   *jsonrpc.JSONRPCServer
}

func (*JSONRPCServerChannel) CanDeliverTo

func (c *JSONRPCServerChannel) CanDeliverTo(address *hyper.Address) bool

func (*JSONRPCServerChannel) Close

func (c *JSONRPCServerChannel) Close() error

func (*JSONRPCServerChannel) DeliverRequest

func (c *JSONRPCServerChannel) DeliverRequest(request *hyper.Request) (*hyper.Response, error)

func (*JSONRPCServerChannel) Open

func (c *JSONRPCServerChannel) Open() error

func (*JSONRPCServerChannel) Type

func (c *JSONRPCServerChannel) Type() string

type ProxyListener

type ProxyListener struct {
	net.Listener
	// contains filtered or unexported fields
}

func MakeProxyListener

func MakeProxyListener(listener net.Listener) *ProxyListener

func (*ProxyListener) Accept

func (l *ProxyListener) Accept() (net.Conn, error)

Accept a connection, ensuring that rate limits are enforced

func (*ProxyListener) Inject

func (l *ProxyListener) Inject(value interface{}) error

func (*ProxyListener) Start

func (l *ProxyListener) Start()

type QUICChannel added in v0.3.1

type QUICChannel struct {
	hyper.BaseChannel
	Settings *QUICSettings
}

func (*QUICChannel) CanDeliverTo added in v0.3.1

func (q *QUICChannel) CanDeliverTo(*hyper.Address) bool

func (*QUICChannel) Close added in v0.3.1

func (q *QUICChannel) Close() error

func (*QUICChannel) DeliverRequest added in v0.3.1

func (q *QUICChannel) DeliverRequest(*hyper.Request) (*hyper.Response, error)

func (*QUICChannel) Open added in v0.3.1

func (q *QUICChannel) Open() error

func (*QUICChannel) Type added in v0.3.1

func (q *QUICChannel) Type() string

type QUICChannelConfig added in v0.3.1

type QUICChannelConfig struct {
	Remote *QUICRemoteChannel `json:"remote"`
	Local  *QUICLocalChannel  `json:"local"`
}

type QUICChannelSettings added in v0.3.1

type QUICChannelSettings struct {
	Address string `json:"address"`
}

type QUICLocalChannel added in v0.3.1

type QUICLocalChannel struct {
	Port int64  `json:"port"`
	Host string `json:"string"`
}

type QUICRemoteChannel added in v0.3.1

type QUICRemoteChannel struct {
	Port int64  `json:"port"`
	Host string `json:"host"`
}

type QUICSettings added in v0.3.1

type QUICSettings struct {
	TLS         *tls.TLSSettings     `json:"tls"`
	BindAddress string               `json:"bindAddress"`
	Channels    []*QUICChannelConfig `json:"channels"`
}

type RequestConnectionResponse

type RequestConnectionResponse struct {
	Token    []byte `json:"token"`
	Endpoint string `json:"endpoint"`
}

type StdoutChannel

type StdoutChannel struct {
	hyper.BaseChannel
	Settings StdoutSettings
}

func (*StdoutChannel) CanDeliverTo

func (c *StdoutChannel) CanDeliverTo(address *hyper.Address) bool

func (*StdoutChannel) Close

func (c *StdoutChannel) Close() error

func (*StdoutChannel) DeliverRequest

func (c *StdoutChannel) DeliverRequest(request *hyper.Request) (*hyper.Response, error)

func (*StdoutChannel) Open

func (c *StdoutChannel) Open() error

func (*StdoutChannel) Type

func (c *StdoutChannel) Type() string

type StdoutSettings

type StdoutSettings struct {
}

Jump to

Keyboard shortcuts

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