edge

package
v0.23.35 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 24 Imported by: 32

Documentation

Index

Constants

View Source
const (
	ContentTypeConnect            = int32(edge_client_pb.ContentType_ConnectType)
	ContentTypeStateConnected     = int32(edge_client_pb.ContentType_StateConnectedType)
	ContentTypeStateClosed        = int32(edge_client_pb.ContentType_StateClosedType)
	ContentTypeData               = int32(edge_client_pb.ContentType_DataType)
	ContentTypeDial               = int32(edge_client_pb.ContentType_DialType)
	ContentTypeDialSuccess        = int32(edge_client_pb.ContentType_DialSuccessType)
	ContentTypeDialFailed         = int32(edge_client_pb.ContentType_DialFailedType)
	ContentTypeBind               = int32(edge_client_pb.ContentType_BindType)
	ContentTypeUnbind             = int32(edge_client_pb.ContentType_UnbindType)
	ContentTypeStateSessionEnded  = int32(edge_client_pb.ContentType_StateSessionEndedType)
	ContentTypeProbe              = int32(edge_client_pb.ContentType_ProbeType)
	ContentTypeUpdateBind         = int32(edge_client_pb.ContentType_UpdateBindType)
	ContentTypeHealthEvent        = int32(edge_client_pb.ContentType_HealthEventType)
	ContentTypeTraceRoute         = int32(edge_client_pb.ContentType_TraceRouteType)
	ContentTypeTraceRouteResponse = int32(edge_client_pb.ContentType_TraceRouteResponseType)

	ContentTypeUpdateToken        = int32(edge_client_pb.ContentType_UpdateTokenType)
	ContentTypeUpdateTokenSuccess = int32(edge_client_pb.ContentType_UpdateTokenSuccessType)
	ContentTypeUpdateTokenFailure = int32(edge_client_pb.ContentType_UpdateTokenFailureType)

	ContentTypePostureResponse = int32(edge_client_pb.ContentType_PostureResponseType)

	ContentTypeConnInspectRequest  = 60798
	ContentTypeConnInspectResponse = 60799
	ContentTypeBindSuccess         = 60800

	ConnIdHeader                   = 1000
	SeqHeader                      = 1001
	SessionTokenHeader             = 1002
	PublicKeyHeader                = 1003
	CostHeader                     = 1004
	PrecedenceHeader               = 1005
	TerminatorIdentityHeader       = 1006
	TerminatorIdentitySecretHeader = 1007
	CallerIdHeader                 = 1008
	CryptoMethodHeader             = 1009
	FlagsHeader                    = 1010
	AppDataHeader                  = 1011
	RouterProvidedConnId           = 1012
	HealthStatusHeader             = 1013
	ErrorCodeHeader                = 1014
	TimestampHeader                = 1015
	TraceHopCountHeader            = 1016
	TraceHopTypeHeader             = 1017
	TraceHopIdHeader               = 1018
	TraceSourceRequestIdHeader     = 1019
	TraceError                     = 1020
	ListenerId                     = 1021
	ConnTypeHeader                 = 1022
	SupportsInspectHeader          = 1023
	SupportsBindSuccessHeader      = 1024
	ConnectionMarkerHeader         = 1025
	CircuitIdHeader                = 1026

	ErrorCodeInternal                    = 1
	ErrorCodeInvalidApiSession           = 2
	ErrorCodeInvalidSession              = 3
	ErrorCodeWrongSessionType            = 4
	ErrorCodeInvalidEdgeRouterForSession = 5
	ErrorCodeInvalidService              = 6
	ErrorCodeTunnelingNotEnabled         = 7
	ErrorCodeInvalidTerminator           = 8
	ErrorCodeInvalidPrecedence           = 9
	ErrorCodeInvalidCost                 = 10
	ErrorCodeEncryptionDataMissing       = 11

	PrecedenceDefault  Precedence = 0
	PrecedenceRequired Precedence = 1
	PrecedenceFailed   Precedence = 2

	// UUIDHeader is put in the reflected range so replies will share the same UUID
	UUIDHeader = 128

	// CryptoMethodLibsodium are used to indicate the crypto engine in use
	CryptoMethodLibsodium CryptoMethod = 0 // default: crypto_kx_*, crypto_secretstream_*
	CryptoMethodSSL       CryptoMethod = 1 // OpenSSL(possibly with FIPS): ECDH, AES256-GCM

	// FIN is an edge payload flag used to signal communication ends
	FIN = 0x1
)
View Source
const InterceptV1 = "intercept.v1"

Variables

View Source
var ContentTypeNames = map[int32]string{
	ContentTypeConnect:            "EdgeConnectType",
	ContentTypeStateConnected:     "EdgeStateConnectedType",
	ContentTypeStateClosed:        "EdgeStateClosedType",
	ContentTypeData:               "EdgeDataType",
	ContentTypeDial:               "EdgeDialType",
	ContentTypeDialSuccess:        "EdgeDialSuccessType",
	ContentTypeDialFailed:         "EdgeDialFailedType",
	ContentTypeBind:               "EdgeBindType",
	ContentTypeUnbind:             "EdgeUnbindType",
	ContentTypeProbe:              "EdgeProbeType",
	ContentTypeUpdateToken:        "EdgeUpdateTokenType",
	ContentTypeUpdateTokenSuccess: "EdgeUpdateTokenSuccessType",
	ContentTypeUpdateTokenFailure: "EdgeUpdateTokenFailureType",
}
View Source
var ContentTypeValue = map[string]int32{
	"EdgeConnectType":            ContentTypeConnect,
	"EdgeStateConnectedType":     ContentTypeStateConnected,
	"EdgeStateClosedType":        ContentTypeStateClosed,
	"EdgeDataType":               ContentTypeData,
	"EdgeDialType":               ContentTypeDial,
	"EdgeDialSuccessType":        ContentTypeDialSuccess,
	"EdgeDialFailedType":         ContentTypeDialFailed,
	"EdgeBindType":               ContentTypeBind,
	"EdgeUnbindType":             ContentTypeUnbind,
	"EdgeProbeType":              ContentTypeProbe,
	"EdgeUpdateTokenType":        ContentTypeUpdateToken,
	"EdgeUpdateTokenSuccessType": ContentTypeUpdateTokenSuccess,
	"EdgeUpdateTokenFailureType": ContentTypeUpdateTokenFailure,
}

Functions

func AddAddressParsers added in v0.20.46

func AddAddressParsers()

func GetLoggerFields

func GetLoggerFields(msg *channel.Message) logrus.Fields

func NewBindMsg

func NewBindMsg(connId uint32, token string, pubKey []byte, options *ListenOptions) *channel.Message

func NewConnInspectResponse added in v0.20.139

func NewConnInspectResponse(connId uint32, connType ConnType, state string) *channel.Message

func NewConnectMsg

func NewConnectMsg(connId uint32, token string, pubKey []byte, options *DialOptions) *channel.Message

func NewDataMsg

func NewDataMsg(connId uint32, seq uint32, data []byte) *channel.Message

func NewDialFailedMsg

func NewDialFailedMsg(connId uint32, message string) *channel.Message

func NewDialMsg

func NewDialMsg(connId uint32, token string, callerId string) *channel.Message

func NewDialSuccessMsg

func NewDialSuccessMsg(connId uint32, newConnId uint32) *channel.Message

func NewHealthEventMsg added in v0.15.30

func NewHealthEventMsg(connId uint32, token string, pass bool) *channel.Message

func NewProbeMsg

func NewProbeMsg() *channel.Message

func NewStateClosedMsg

func NewStateClosedMsg(connId uint32, message string) *channel.Message

func NewStateConnectedMsg

func NewStateConnectedMsg(connId uint32) *channel.Message

func NewStateSessionEndedMsg

func NewStateSessionEndedMsg(reason string) *channel.Message

func NewTraceRouteMsg added in v0.15.105

func NewTraceRouteMsg(connId uint32, hops uint32, timestamp uint64) *channel.Message

func NewTraceRouteResponseMsg added in v0.15.105

func NewTraceRouteResponseMsg(connId uint32, hops uint32, timestamp uint64, hopType, hopId string) *channel.Message

func NewUnbindMsg

func NewUnbindMsg(connId uint32, token string) *channel.Message

func NewUpdateBindMsg

func NewUpdateBindMsg(connId uint32, token string, cost *uint16, precedence *Precedence) *channel.Message

func NewUpdateTokenFailedMsg added in v0.22.6

func NewUpdateTokenFailedMsg(err error) *channel.Message

NewUpdateTokenFailedMsg is returned in response to a token update where the token failed validation.

func NewUpdateTokenMsg added in v0.22.6

func NewUpdateTokenMsg(token []byte) *channel.Message

NewUpdateTokenMsg creates a message sent to edge routers to update the token that allows the client to stay connection. If the token is not update before the current one expires, the connection and all service connections through it will be terminated.

func NewUpdateTokenSuccessMsg added in v0.22.6

func NewUpdateTokenSuccessMsg() *channel.Message

NewUpdateTokenSuccessMsg is returned in response to a toke update where the token was accepted.

func ParseServiceConfig added in v0.19.0

func ParseServiceConfig(service *rest_model.ServiceDetail, configType string, target interface{}) (bool, error)

Types

type Addr

type Addr struct {
	MsgCh MsgChannel
}

func (*Addr) Network

func (e *Addr) Network() string

func (*Addr) String

func (e *Addr) String() string

type ClientConfig added in v0.17.0

type ClientConfig struct {
	Protocol string
	Hostname ZitiAddress
	Port     int
}

func (*ClientConfig) String added in v0.17.0

func (s *ClientConfig) String() string

func (*ClientConfig) ToInterceptV1Config added in v0.17.0

func (self *ClientConfig) ToInterceptV1Config() *InterceptV1Config

type CloseWriter added in v0.14.0

type CloseWriter interface {
	CloseWrite() error
}

type Conn

type Conn interface {
	ServiceConn
	Identifiable
	CompleteAcceptSuccess() error
	CompleteAcceptFailed(err error)
}

type ConnOptions

type ConnOptions interface {
	GetConnectTimeout() time.Duration
}

type ConnType added in v0.20.139

type ConnType byte
const (
	ConnTypeInvalid ConnType = 0
	ConnTypeDial    ConnType = 1
	ConnTypeBind    ConnType = 2
	ConnTypeUnknown ConnType = 3
)

type CowMapMsgMux added in v0.15.0

type CowMapMsgMux struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*CowMapMsgMux) AddMsgSink added in v0.15.0

func (mux *CowMapMsgMux) AddMsgSink(sink MsgSink) error

func (*CowMapMsgMux) Close added in v0.15.0

func (mux *CowMapMsgMux) Close()

func (*CowMapMsgMux) ContentType added in v0.15.0

func (mux *CowMapMsgMux) ContentType() int32

func (*CowMapMsgMux) GetNextId added in v0.15.2

func (mux *CowMapMsgMux) GetNextId() uint32

func (*CowMapMsgMux) HandleClose added in v0.15.0

func (mux *CowMapMsgMux) HandleClose(channel.Channel)

func (*CowMapMsgMux) HandleReceive added in v0.15.0

func (mux *CowMapMsgMux) HandleReceive(msg *channel.Message, ch channel.Channel)

func (*CowMapMsgMux) RemoveMsgSink added in v0.15.0

func (mux *CowMapMsgMux) RemoveMsgSink(sink MsgSink)

func (*CowMapMsgMux) RemoveMsgSinkById added in v0.15.0

func (mux *CowMapMsgMux) RemoveMsgSinkById(sinkId uint32)

type CryptoMethod added in v0.13.55

type CryptoMethod byte

type DialOptions added in v0.13.47

type DialOptions struct {
	ConnectTimeout time.Duration
	Identity       string
	CallerId       string
	AppData        []byte
}

func (DialOptions) GetConnectTimeout added in v0.13.47

func (d DialOptions) GetConnectTimeout() time.Duration

type DialResult

type DialResult struct {
	ConnId    uint32
	NewConnId uint32
	Success   bool
	Message   string
}

func UnmarshalDialResult

func UnmarshalDialResult(msg *channel.Message) (*DialResult, error)

type DomainName added in v0.17.0

type DomainName string

func (DomainName) Match added in v0.17.0

func (dn DomainName) Match(hostname string) int

type Identifiable

type Identifiable interface {
	Id() uint32
}

type InspectResult added in v0.20.139

type InspectResult struct {
	ConnId uint32
	Type   ConnType
	Detail string
}

func UnmarshalInspectResult added in v0.20.139

func UnmarshalInspectResult(msg *channel.Message) (*InspectResult, error)

type InterceptDialOptions added in v0.19.0

type InterceptDialOptions struct {
	ConnectTimeoutSeconds *int
	Identity              *string
}

type InterceptV1Config added in v0.17.0

type InterceptV1Config struct {
	Addresses   []ZitiAddress
	PortRanges  []*PortRange
	Protocols   []string
	SourceIp    *string
	DialOptions *InterceptDialOptions `json:"dialOptions"`
	Service     *rest_model.ServiceDetail
}

func (*InterceptV1Config) Match added in v0.17.0

func (intercept *InterceptV1Config) Match(network, hostname string, port uint16) int

Match returns the matching score of the given target address against this intercept. A negative one (-1) is returned if no match is found. If the address is matched, a 32bit integer with upper bits set to the hostname match and lower bits to port match.

type ListenOptions

type ListenOptions struct {
	Cost                  uint16
	Precedence            Precedence
	ConnectTimeout        time.Duration
	MaxTerminators        int
	Identity              string
	IdentitySecret        string
	BindUsingEdgeIdentity bool
	ManualStart           bool
	ListenerId            string
	KeyPair               *kx.KeyPair
	// contains filtered or unexported fields
}

func NewListenOptions added in v0.21.2

func NewListenOptions() *ListenOptions

func (*ListenOptions) GetConnectTimeout

func (options *ListenOptions) GetConnectTimeout() time.Duration

func (*ListenOptions) GetEventChannel added in v0.21.2

func (options *ListenOptions) GetEventChannel() chan *ListenerEvent

func (*ListenOptions) String

func (options *ListenOptions) String() string

type Listener

type Listener interface {
	net.Listener
	Identifiable
	AcceptEdge() (Conn, error)
	IsClosed() bool
	UpdateCost(cost uint16) error
	UpdatePrecedence(precedence Precedence) error
	UpdateCostAndPrecedence(cost uint16, precedence Precedence) error
	SendHealthEvent(pass bool) error
}

type ListenerEvent added in v0.21.2

type ListenerEvent struct {
	EventType ListenerEventType
}

type ListenerEventType added in v0.21.2

type ListenerEventType int
const (
	ListenerEstablished ListenerEventType = 1
)

type MsgChannel

type MsgChannel struct {
	channel.Channel
	// contains filtered or unexported fields
}

func NewEdgeMsgChannel

func NewEdgeMsgChannel(ch channel.Channel, connId uint32) *MsgChannel

func (*MsgChannel) Id

func (ec *MsgChannel) Id() uint32

func (*MsgChannel) NextMsgId added in v0.15.0

func (ec *MsgChannel) NextMsgId() uint32

func (*MsgChannel) SendState

func (ec *MsgChannel) SendState(msg *channel.Message) error

func (*MsgChannel) SetWriteDeadline

func (ec *MsgChannel) SetWriteDeadline(t time.Time) error

func (*MsgChannel) TraceMsg

func (ec *MsgChannel) TraceMsg(source string, msg *channel.Message)

func (*MsgChannel) Write

func (ec *MsgChannel) Write(data []byte) (n int, err error)

func (*MsgChannel) WriteTraced

func (ec *MsgChannel) WriteTraced(data []byte, msgUUID []byte, hdrs map[int32][]byte) (int, error)

type MsgEvent

type MsgEvent struct {
	ConnId  uint32
	Seq     uint32
	MsgUUID []byte
	Msg     *channel.Message
}

type MsgMux

type MsgMux interface {
	channel.TypedReceiveHandler
	channel.CloseHandler
	AddMsgSink(sink MsgSink) error
	RemoveMsgSink(sink MsgSink)
	RemoveMsgSinkById(sinkId uint32)
	Close()
	GetNextId() uint32
}

func NewCowMapMsgMux added in v0.15.0

func NewCowMapMsgMux() MsgMux

type MsgSink

type MsgSink interface {
	HandleMuxClose() error
	Id() uint32
	Accept(msg *channel.Message)
}

type PortRange added in v0.17.0

type PortRange struct {
	Low  uint16
	High uint16
}

func (*PortRange) Match added in v0.17.0

func (pr *PortRange) Match(port uint16) int

type Precedence

type Precedence byte

type RouterClient added in v0.15.5

type RouterClient interface {
	Connect(service *rest_model.ServiceDetail, session *rest_model.SessionDetail, options *DialOptions) (Conn, error)
	Listen(service *rest_model.ServiceDetail, session *rest_model.SessionDetail, options *ListenOptions) (Listener, error)

	//UpdateToken will attempt to send token updates to the connected router. A success/failure response is expected
	//within the timeout period.
	UpdateToken(token []byte, timeout time.Duration) error
}

type RouterConn

type RouterConn interface {
	channel.BindHandler
	io.Closer
	RouterClient
	IsClosed() bool
	Key() string
	GetRouterName() string
	GetBoolHeader(key int32) bool
}

type ServiceConn added in v0.12.0

type ServiceConn interface {
	net.Conn
	CloseWriter
	IsClosed() bool
	GetAppData() []byte
	SourceIdentifier() string
	TraceRoute(hops uint32, timeout time.Duration) (*TraceRouteResult, error)
	GetCircuitId() string
}

type SessionListener added in v0.13.2

type SessionListener interface {
	Listener
	GetCurrentSession() *rest_model.SessionDetail
	SetConnectionChangeHandler(func(conn []Listener))
	SetErrorEventHandler(func(error))
	GetErrorEventHandler() func(error)
}

type TraceRouteResult added in v0.15.105

type TraceRouteResult struct {
	Hops    uint32
	Time    time.Duration
	HopType string
	HopId   string
	Error   string
}

type ZitiAddress added in v0.17.0

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

func NewZitiAddress added in v0.17.0

func NewZitiAddress(str string) (*ZitiAddress, error)

func (*ZitiAddress) Matches added in v0.17.0

func (self *ZitiAddress) Matches(v any) int

func (*ZitiAddress) UnmarshalText added in v0.17.0

func (self *ZitiAddress) UnmarshalText(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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