pogs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalAuthentication

func MarshalAuthentication(s tunnelrpc.Authentication, p *Authentication) error

func MarshalError

func MarshalError(s tunnelrpc.ConnectionError, err error) error

func MarshalServerInfo

func MarshalServerInfo(s tunnelrpc.ServerInfo, p *ServerInfo) error

func SessionManager_ServerToClient

func SessionManager_ServerToClient(s SessionManager) tunnelrpc.SessionManager

func TunnelServer_ServerToClient

func TunnelServer_ServerToClient(s TunnelServer) tunnelrpc.TunnelServer

Types

type AuthFail

type AuthFail struct {
	// contains filtered or unexported fields
}

AuthFail means this netscale has the wrong auth and should exit.

func NewAuthFail

func NewAuthFail(err error) AuthFail

func (AuthFail) Error

func (ao AuthFail) Error() string

func (AuthFail) Serialize

func (ao AuthFail) Serialize() AuthenticateResponse

Serialize into an AuthenticateResponse which can be sent via Capnp

type AuthOutcome

type AuthOutcome interface {

	// Serialize into an AuthenticateResponse which can be sent via Capnp
	Serialize() AuthenticateResponse
	// contains filtered or unexported methods
}

AuthOutcome is a programmer-friendly sum type denoting the possible outcomes of Authenticate.

type AuthSuccess

type AuthSuccess struct {
	// contains filtered or unexported fields
}

AuthSuccess means the backend successfully authenticated this netscale.

func NewAuthSuccess

func NewAuthSuccess(jwt []byte, hoursUntilRefresh uint8) AuthSuccess

func (AuthSuccess) JWT

func (ao AuthSuccess) JWT() []byte

func (AuthSuccess) RefreshAfter

func (ao AuthSuccess) RefreshAfter() time.Duration

RefreshAfter is how long netscale should wait before rerunning Authenticate.

func (AuthSuccess) Serialize

func (ao AuthSuccess) Serialize() AuthenticateResponse

Serialize into an AuthenticateResponse which can be sent via Capnp

type AuthUnknown

type AuthUnknown struct {
	// contains filtered or unexported fields
}

AuthUnknown means the backend couldn't finish checking authentication. Try again later.

func NewAuthUnknown

func NewAuthUnknown(err error, hoursUntilRefresh uint8) AuthUnknown

func (AuthUnknown) Error

func (ao AuthUnknown) Error() string

func (AuthUnknown) RefreshAfter

func (ao AuthUnknown) RefreshAfter() time.Duration

RefreshAfter is how long netscale should wait before rerunning Authenticate.

func (AuthUnknown) Serialize

func (ao AuthUnknown) Serialize() AuthenticateResponse

Serialize into an AuthenticateResponse which can be sent via Capnp

type AuthenticateResponse

type AuthenticateResponse struct {
	PermanentErr      string
	RetryableErr      string
	Jwt               []byte
	HoursUntilRefresh uint8
}

AuthenticateResponse is the serialized response from the Authenticate RPC. It's a 1:1 representation of the capnp message, so it's not very useful for programmers. Instead, you should call the `Outcome()` method to get a programmer-friendly sum type, with one case for each possible outcome.

func (AuthenticateResponse) Outcome

func (ar AuthenticateResponse) Outcome() AuthOutcome

Outcome turns the deserialized response of Authenticate into a programmer-friendly sum type.

type Authentication

type Authentication struct {
	Key         string
	Email       string
	OriginCAKey string
}

func UnmarshalAuthentication

func UnmarshalAuthentication(s tunnelrpc.Authentication) (*Authentication, error)

type ClientInfo

type ClientInfo struct {
	ClientID []byte `capnp:"clientId"` // must be a slice for capnp compatibility
	Features []string
	Version  string
	Arch     string
}

type ConfigurationManager

type ConfigurationManager interface {
	UpdateConfiguration(ctx context.Context, version int32, config []byte) *UpdateConfigurationResponse
}

type ConfigurationManager_PogsClient

type ConfigurationManager_PogsClient struct {
	Client capnp.Client
	Conn   *rpc.Conn
}

func (ConfigurationManager_PogsClient) Close

func (ConfigurationManager_PogsClient) UpdateConfiguration

func (c ConfigurationManager_PogsClient) UpdateConfiguration(ctx context.Context, version int32, config []byte) (*UpdateConfigurationResponse, error)

type ConfigurationManager_PogsImpl

type ConfigurationManager_PogsImpl struct {
	// contains filtered or unexported fields
}

func (ConfigurationManager_PogsImpl) UpdateConfiguration

type ConnectionDetails

type ConnectionDetails struct {
	UUID                    uuid.UUID
	Location                string
	TunnelIsRemotelyManaged bool
}

func (*ConnectionDetails) MarshalCapnproto

func (details *ConnectionDetails) MarshalCapnproto(s tunnelrpc.ConnectionDetails) error

func (*ConnectionDetails) UnmarshalCapnproto

func (details *ConnectionDetails) UnmarshalCapnproto(s tunnelrpc.ConnectionDetails) error

type ConnectionOptions

type ConnectionOptions struct {
	Client              ClientInfo
	OriginLocalIP       net.IP `capnp:"originLocalIp"`
	ReplaceExisting     bool
	CompressionQuality  uint8
	NumPreviousAttempts uint8
}

func (*ConnectionOptions) MarshalCapnproto

func (p *ConnectionOptions) MarshalCapnproto(s tunnelrpc.ConnectionOptions) error

func (*ConnectionOptions) UnmarshalCapnproto

func (p *ConnectionOptions) UnmarshalCapnproto(s tunnelrpc.ConnectionOptions) error

type NetscaleServer

type NetscaleServer interface {
	SessionManager
	ConfigurationManager
}

type NetscaleServer_PogsClient

type NetscaleServer_PogsClient struct {
	SessionManager_PogsClient
	ConfigurationManager_PogsClient
	Client capnp.Client
	Conn   *rpc.Conn
}

func NewNetscaleServer_PogsClient

func NewNetscaleServer_PogsClient(client capnp.Client, conn *rpc.Conn) NetscaleServer_PogsClient

func (NetscaleServer_PogsClient) Close

func (c NetscaleServer_PogsClient) Close() error

type PermanentRegistrationError

type PermanentRegistrationError struct {
	// contains filtered or unexported fields
}

func (*PermanentRegistrationError) Error

func (pre *PermanentRegistrationError) Error() string

func (*PermanentRegistrationError) IsPermanent

func (*PermanentRegistrationError) IsPermanent() bool

func (*PermanentRegistrationError) Serialize

type RPCError

type RPCError struct {
	// contains filtered or unexported fields
}

RPCError is used to indicate errors returned by the RPC subsystem rather than failure of a remote operation

func (*RPCError) Error

func (re *RPCError) Error() string

func (*RPCError) Unwrap

func (re *RPCError) Unwrap() error

type RegisterUdpSessionResponse

type RegisterUdpSessionResponse struct {
	Err   error
	Spans []byte // Spans in protobuf format
}

func (*RegisterUdpSessionResponse) Marshal

func (*RegisterUdpSessionResponse) Unmarshal

type RegistrationOptions

type RegistrationOptions struct {
	ClientID             string `capnp:"clientId"`
	Version              string
	OS                   string `capnp:"os"`
	ExistingTunnelPolicy tunnelrpc.ExistingTunnelPolicy
	PoolName             string `capnp:"poolName"`
	Tags                 []Tag
	ConnectionID         uint8  `capnp:"connectionId"`
	OriginLocalIP        string `capnp:"originLocalIp"`
	IsAutoupdated        bool   `capnp:"isAutoupdated"`
	RunFromTerminal      bool   `capnp:"runFromTerminal"`
	CompressionQuality   uint64 `capnp:"compressionQuality"`
	UUID                 string `capnp:"uuid"`
	NumPreviousAttempts  uint8
	Features             []string
}

type RegistrationServer

type RegistrationServer interface {
	RegisterConnection(ctx context.Context, auth TunnelAuth, tunnelID uuid.UUID, connIndex byte, options *ConnectionOptions) (*ConnectionDetails, error)
	UnregisterConnection(ctx context.Context)
	UpdateLocalConfiguration(ctx context.Context, config []byte) error
}

type RegistrationServer_PogsClient

type RegistrationServer_PogsClient struct {
	Client capnp.Client
	Conn   *rpc.Conn
}

func (RegistrationServer_PogsClient) Close

func (RegistrationServer_PogsClient) RegisterConnection

func (c RegistrationServer_PogsClient) RegisterConnection(ctx context.Context, auth TunnelAuth, tunnelID uuid.UUID, connIndex byte, options *ConnectionOptions) (*ConnectionDetails, error)

func (RegistrationServer_PogsClient) SendLocalConfiguration

func (c RegistrationServer_PogsClient) SendLocalConfiguration(ctx context.Context, config []byte) error

func (RegistrationServer_PogsClient) UnregisterConnection

func (c RegistrationServer_PogsClient) UnregisterConnection(ctx context.Context) error

type RegistrationServer_PogsImpl

type RegistrationServer_PogsImpl struct {
	// contains filtered or unexported fields
}

func (RegistrationServer_PogsImpl) RegisterConnection

func (RegistrationServer_PogsImpl) UnregisterConnection

func (RegistrationServer_PogsImpl) UpdateLocalConfiguration

type RetryableError

type RetryableError struct {
	Delay time.Duration
	// contains filtered or unexported fields
}

func RetryErrorAfter

func RetryErrorAfter(err error, delay time.Duration) *RetryableError

RetryErrorAfter wraps err to indicate that client should retry after delay

func (*RetryableError) Error

func (re *RetryableError) Error() string

func (*RetryableError) Unwrap

func (re *RetryableError) Unwrap() error

type RetryableRegistrationError

type RetryableRegistrationError struct {
	// contains filtered or unexported fields
}

func (*RetryableRegistrationError) Error

func (rre *RetryableRegistrationError) Error() string

func (*RetryableRegistrationError) IsPermanent

func (*RetryableRegistrationError) IsPermanent() bool

func (*RetryableRegistrationError) Serialize

type ServerInfo

type ServerInfo struct {
	LocationName string
}

func UnmarshalServerInfo

func UnmarshalServerInfo(s tunnelrpc.ServerInfo) (*ServerInfo, error)

type SessionManager

type SessionManager interface {
	// RegisterUdpSession is the call provided to netscale to handle an incoming
	// capnproto RegisterUdpSession request from the edge.
	RegisterUdpSession(ctx context.Context, sessionID uuid.UUID, dstIP net.IP, dstPort uint16, closeAfterIdleHint time.Duration, traceContext string) (*RegisterUdpSessionResponse, error)
	// UnregisterUdpSession is the call provided to netscale to handle an incoming
	// capnproto UnregisterUdpSession request from the edge.
	UnregisterUdpSession(ctx context.Context, sessionID uuid.UUID, message string) error
}

type SessionManager_PogsClient

type SessionManager_PogsClient struct {
	Client capnp.Client
	Conn   *rpc.Conn
}

func (SessionManager_PogsClient) Close

func (c SessionManager_PogsClient) Close() error

func (SessionManager_PogsClient) RegisterUdpSession

func (c SessionManager_PogsClient) RegisterUdpSession(ctx context.Context, sessionID uuid.UUID, dstIP net.IP, dstPort uint16, closeAfterIdleHint time.Duration, traceContext string) (*RegisterUdpSessionResponse, error)

func (SessionManager_PogsClient) UnregisterUdpSession

func (c SessionManager_PogsClient) UnregisterUdpSession(ctx context.Context, sessionID uuid.UUID, message string) error

type SessionManager_PogsImpl

type SessionManager_PogsImpl struct {
	// contains filtered or unexported fields
}

func (SessionManager_PogsImpl) RegisterUdpSession

func (SessionManager_PogsImpl) UnregisterUdpSession

type SuccessfulTunnelRegistration

type SuccessfulTunnelRegistration struct {
	Url         string
	LogLines    []string
	TunnelID    string `capnp:"tunnelID"`
	EventDigest []byte
	ConnDigest  []byte
}

type Tag

type Tag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type TunnelAuth

type TunnelAuth struct {
	AccountTag   string
	TunnelSecret []byte
}

func (*TunnelAuth) MarshalCapnproto

func (a *TunnelAuth) MarshalCapnproto(s tunnelrpc.TunnelAuth) error

func (*TunnelAuth) UnmarshalCapnproto

func (a *TunnelAuth) UnmarshalCapnproto(s tunnelrpc.TunnelAuth) error

type TunnelRegistration

type TunnelRegistration struct {
	SuccessfulTunnelRegistration
	Err               string
	PermanentFailure  bool
	RetryAfterSeconds uint16
}

func NewSuccessfulTunnelRegistration

func NewSuccessfulTunnelRegistration(
	url string,
	logLines []string,
	tunnelID string,
	eventDigest []byte,
	connDigest []byte,
) *TunnelRegistration

func (TunnelRegistration) DeserializeError

func (tr TunnelRegistration) DeserializeError() TunnelRegistrationError

Not calling this function Error() to avoid confusion with implementing error interface

type TunnelRegistrationError

type TunnelRegistrationError interface {
	error
	Serialize() *TunnelRegistration
	IsPermanent() bool
}

func NewPermanentRegistrationError

func NewPermanentRegistrationError(err error) TunnelRegistrationError

func NewRetryableRegistrationError

func NewRetryableRegistrationError(err error, retryAfterSeconds uint16) TunnelRegistrationError

type TunnelServer

type TunnelServer interface {
	RegistrationServer
	RegisterTunnel(ctx context.Context, originCert []byte, hostname string, options *RegistrationOptions) *TunnelRegistration
	GetServerInfo(ctx context.Context) (*ServerInfo, error)
	UnregisterTunnel(ctx context.Context, gracePeriodNanoSec int64) error
	Authenticate(ctx context.Context, originCert []byte, hostname string, options *RegistrationOptions) (*AuthenticateResponse, error)
	ReconnectTunnel(ctx context.Context, jwt, eventDigest, connDigest []byte, hostname string, options *RegistrationOptions) (*TunnelRegistration, error)
}

type TunnelServer_PogsClient

type TunnelServer_PogsClient struct {
	RegistrationServer_PogsClient
	Client capnp.Client
	Conn   *rpc.Conn
}

func (TunnelServer_PogsClient) Authenticate

func (c TunnelServer_PogsClient) Authenticate(ctx context.Context, originCert []byte, hostname string, options *RegistrationOptions) (*AuthenticateResponse, error)

func (TunnelServer_PogsClient) Close

func (c TunnelServer_PogsClient) Close() error

func (TunnelServer_PogsClient) GetServerInfo

func (c TunnelServer_PogsClient) GetServerInfo(ctx context.Context) (*ServerInfo, error)

func (TunnelServer_PogsClient) ReconnectTunnel

func (c TunnelServer_PogsClient) ReconnectTunnel(
	ctx context.Context,
	jwt,
	eventDigest []byte,
	connDigest []byte,
	hostname string,
	options *RegistrationOptions,
) *TunnelRegistration

func (TunnelServer_PogsClient) RegisterTunnel

func (c TunnelServer_PogsClient) RegisterTunnel(ctx context.Context, originCert []byte, hostname string, options *RegistrationOptions) *TunnelRegistration

func (TunnelServer_PogsClient) UnregisterTunnel

func (c TunnelServer_PogsClient) UnregisterTunnel(ctx context.Context, gracePeriodNanoSec int64) error

type TunnelServer_PogsImpl

type TunnelServer_PogsImpl struct {
	RegistrationServer_PogsImpl
	// contains filtered or unexported fields
}

func (TunnelServer_PogsImpl) Authenticate

func (TunnelServer_PogsImpl) GetServerInfo

func (TunnelServer_PogsImpl) ObsoleteDeclarativeTunnelConnect

func (TunnelServer_PogsImpl) ReconnectTunnel

func (TunnelServer_PogsImpl) RegisterTunnel

func (TunnelServer_PogsImpl) UnregisterTunnel

type UpdateConfigurationResponse

type UpdateConfigurationResponse struct {
	LastAppliedVersion int32 `json:"lastAppliedVersion"`
	Err                error `json:"err"`
}

func (*UpdateConfigurationResponse) Marshal

func (*UpdateConfigurationResponse) Unmarshal

Jump to

Keyboard shortcuts

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