ospc

package
v0.0.0-...-0d23b08 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentCapabilityDataChannels   msgAgentCapability = 1100
	AgentCapabilityQuickTransport msgAgentCapability = 1200
)
View Source
const (
	DataChannelEncodingIdEncodingIdBlob        msgDataChannelEncodingId = 0
	DataChannelEncodingIdEncodingIdString      msgDataChannelEncodingId = 1
	DataChannelEncodingIdEncodingIdArrayBuffer msgDataChannelEncodingId = 2
)
View Source
const (
	AgentCapabilityReceiveAudio          msgAgentCapability = 1
	AgentCapabilityReceiveVideo          msgAgentCapability = 2
	AgentCapabilityReceivePresentation   msgAgentCapability = 3
	AgentCapabilityControlPresentation   msgAgentCapability = 4
	AgentCapabilityReceiveRemotePlayback msgAgentCapability = 5
	AgentCapabilityControlRemotePlayback msgAgentCapability = 6
	AgentCapabilityReceiveStreaming      msgAgentCapability = 7
	AgentCapabilitySendStreaming         msgAgentCapability = 8
)
View Source
const (
	PskInputMethodNumeric msgPskInputMethod = 0
	PskInputMethodQrCode  msgPskInputMethod = 1
)
View Source
const (
	AuthSpake2PskStatusPskNeedsPresentation msgAuthSpake2PskStatus = 0
	AuthSpake2PskStatusPskShown             msgAuthSpake2PskStatus = 1
	AuthSpake2PskStatusPskInput             msgAuthSpake2PskStatus = 2
)
View Source
const (
	AuthStatusResultAuthenticated         msgAuthStatusResult = 0
	AuthStatusResultUnknownError          msgAuthStatusResult = 1
	AuthStatusResultTimeout               msgAuthStatusResult = 2
	AuthStatusResultSecretUnknown         msgAuthStatusResult = 3
	AuthStatusResultValidationTookTooLong msgAuthStatusResult = 4
	AuthStatusResultProofInvalid          msgAuthStatusResult = 5
)
View Source
const (
	UrlAvailabilityAvailable   msgUrlAvailability = 0
	UrlAvailabilityUnavailable msgUrlAvailability = 1
	UrlAvailabilityInvalid     msgUrlAvailability = 10
)
View Source
const (
	PresentationTerminationSourceController msgPresentationTerminationSource = 1
	PresentationTerminationSourceReceiver   msgPresentationTerminationSource = 2
	PresentationTerminationSourceUnknown    msgPresentationTerminationSource = 255
)
View Source
const (
	PresentationTerminationReasonApplicationRequest           msgPresentationTerminationReason = 1
	PresentationTerminationReasonUserRequest                  msgPresentationTerminationReason = 2
	PresentationTerminationReasonReceiverReplacedPresentation msgPresentationTerminationReason = 20
	PresentationTerminationReasonReceiverIdleTooLong          msgPresentationTerminationReason = 30
	PresentationTerminationReasonReceiverAttemptedToNavigate  msgPresentationTerminationReason = 31
	PresentationTerminationReasonReceiverPoweringDown         msgPresentationTerminationReason = 100
	PresentationTerminationReasonReceiverError                msgPresentationTerminationReason = 101
	PresentationTerminationReasonUnknown                      msgPresentationTerminationReason = 255
)
View Source
const (
	PresentationConnectionCloseEventReasonCloseMethodCalled                                msgPresentationConnectionCloseEventReason = 1
	PresentationConnectionCloseEventReasonConnectionObjectDiscarded                        msgPresentationConnectionCloseEventReason = 10
	PresentationConnectionCloseEventReasonUnrecoverableErrorWhileSendingOrReceivingMessage msgPresentationConnectionCloseEventReason = 100
)
View Source
const (
	ResultSuccess               msgResult = 1
	ResultInvalidUrl            msgResult = 10
	ResultInvalidPresentationId msgResult = 11
	ResultTimeout               msgResult = 100
	ResultTransientError        msgResult = 101
	ResultPermanentError        msgResult = 102
	ResultTerminating           msgResult = 103
	ResultUnknownError          msgResult = 199
)
View Source
const (
	RemotePlaybackTerminationRequestReasonUserTerminatedViaController msgRemotePlaybackTerminationRequestReason = 11
	RemotePlaybackTerminationRequestReasonUnknown                     msgRemotePlaybackTerminationRequestReason = 255
)
View Source
const (
	RemotePlaybackTerminationEventReasonReceiverCalledTerminate   msgRemotePlaybackTerminationEventReason = 1
	RemotePlaybackTerminationEventReasonUserTerminatedViaReceiver msgRemotePlaybackTerminationEventReason = 2
	RemotePlaybackTerminationEventReasonReceiverIdleTooLong       msgRemotePlaybackTerminationEventReason = 30
	RemotePlaybackTerminationEventReasonReceiverPoweringDown      msgRemotePlaybackTerminationEventReason = 100
	RemotePlaybackTerminationEventReasonReceiverCrashed           msgRemotePlaybackTerminationEventReason = 101
	RemotePlaybackTerminationEventReasonUnknown                   msgRemotePlaybackTerminationEventReason = 255
)
View Source
const (
	RemotePlaybackControlsPreloadNone     msgRemotePlaybackControlsPreload = 0
	RemotePlaybackControlsPreloadMetadata msgRemotePlaybackControlsPreload = 1
	RemotePlaybackControlsPreloadAuto     msgRemotePlaybackControlsPreload = 2
)
View Source
const (
	RemotePlaybackStateLoadingEmpty    msgRemotePlaybackStateLoading = 0
	RemotePlaybackStateLoadingIdle     msgRemotePlaybackStateLoading = 1
	RemotePlaybackStateLoadingLoading  msgRemotePlaybackStateLoading = 2
	RemotePlaybackStateLoadingNoSource msgRemotePlaybackStateLoading = 3
)
View Source
const (
	RemotePlaybackStateLoadedNothing  msgRemotePlaybackStateLoaded = 0
	RemotePlaybackStateLoadedMetadata msgRemotePlaybackStateLoaded = 1
	RemotePlaybackStateLoadedCurrent  msgRemotePlaybackStateLoaded = 2
	RemotePlaybackStateLoadedFuture   msgRemotePlaybackStateLoaded = 3
	RemotePlaybackStateLoadedEnough   msgRemotePlaybackStateLoaded = 4
)
View Source
const (
	AddedTextTrackKindSubtitles    msgAddedTextTrackKind = 1
	AddedTextTrackKindCaptions     msgAddedTextTrackKind = 2
	AddedTextTrackKindDescriptions msgAddedTextTrackKind = 3
	AddedTextTrackKindChapters     msgAddedTextTrackKind = 4
	AddedTextTrackKindMetadata     msgAddedTextTrackKind = 5
)
View Source
const (
	TextTrackModeDisabled msgTextTrackMode = 1
	TextTrackModeShowing  msgTextTrackMode = 2
	TextTrackModeHidden   msgTextTrackMode = 3
)
View Source
const (
	MediaErrorMsgCodeUserAborted        msgMediaErrorMsgCode = 1
	MediaErrorMsgCodeNetworkError       msgMediaErrorMsgCode = 2
	MediaErrorMsgCodeDecodeError        msgMediaErrorMsgCode = 3
	MediaErrorMsgCodeSourceNotSupported msgMediaErrorMsgCode = 4
	MediaErrorMsgCodeUnknownError       msgMediaErrorMsgCode = 5
)
View Source
const (
	VideoRotationVideoRotation0   msgVideoRotation = 0
	VideoRotationVideoRotation90  msgVideoRotation = 1
	VideoRotationVideoRotation180 msgVideoRotation = 2
	VideoRotationVideoRotation270 msgVideoRotation = 3
)
View Source
const (
	StreamingBufferStatusEnoughData       msgStreamingBufferStatus = 0
	StreamingBufferStatusInsufficientData msgStreamingBufferStatus = 1
	StreamingBufferStatusTooMuchData      msgStreamingBufferStatus = 2
)
View Source
const (
	DataEncodingBinary = iota
	DataEncodingString
	DataEncodingArrayBuffer
)
View Source
const (
	MdnsServiceType = "_openscreen._udp"
	MdnsDomain      = "local"
	ALPN_OSP        = "osp"
)
View Source
const MTU = 8192

Variables

View Source
var ErrConnectionClosed = errors.New("connection closed")
View Source
var ErrDiscovererClosed = errors.New("discoverer closed")
View Source
var ErrHandedOff = errors.New("connection handed off")
View Source
var ErrListenerClosed = errors.New("listener closed")
View Source
var ErrTransportClosed = errors.New("transport closed")
View Source
var ErrTransportHandedOff = errors.New("transport handed off")

Functions

This section is empty.

Types

type ALPNListener

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

ALPNListener allows listening for application protocols on the same port as OSP.

func (*ALPNListener) Accept

func (l *ALPNListener) Accept(ctx context.Context) (quic.Connection, error)

func (*ALPNListener) Close

func (l *ALPNListener) Close() error

type ALPNListenerConfig

type ALPNListenerConfig struct {
	VerifyConnection func(cs tls.ConnectionState) error
}

type Agent

type Agent struct {
	PeerID PeerID

	Certificate          *tls.Certificate
	CertificateSNBase    uint32
	CertificateSNCounter uint32
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent(c AgentConfig) (*Agent, error)

func (*Agent) AuthenticationInfo

func (a *Agent) AuthenticationInfo() *AgentAuthenticationInfo

func (*Agent) CertificateFingerPrint

func (a *Agent) CertificateFingerPrint() (string, error)

func (*Agent) HasAuthenticationInfo

func (a *Agent) HasAuthenticationInfo() bool

func (*Agent) HasInfo

func (a *Agent) HasInfo() bool

func (*Agent) Info

func (a *Agent) Info() *AgentInfo

func (*Agent) NewRemoteAgent

func (a *Agent) NewRemoteAgent(nc NetworkConnection) (*Agent, error)

type AgentAuthenticationInfo

type AgentAuthenticationInfo struct {
	PSKConfig PSKConfig
}

type AgentConfig

type AgentConfig struct {
	// ID
	PeerID            PeerID
	Certificate       *tls.Certificate
	CertificateSNBase uint32

	// Info
	DisplayName string
	ModelName   string
	Locales     []string

	// AuthInfo
	PSKConfig PSKConfig

	SupportedTransports []AgentTransport
}

func NewAgentConfig

func NewAgentConfig(nickname string) AgentConfig

func (*AgentConfig) WithCertificateSNBase

func (c *AgentConfig) WithCertificateSNBase(snBase uint32)

func (*AgentConfig) WithModelName

func (c *AgentConfig) WithModelName(easeOfInput, entropy int)

func (*AgentConfig) WithPSKConfig

func (c *AgentConfig) WithPSKConfig(easeOfInput, entropy int)

type AgentInfo

type AgentInfo struct {
	DisplayName string
	ModelName   string
	// Capabilities []agentCapability
	// StateToken string // TODO: State token
	Locales []string
}

type AgentRole

type AgentRole int
const (
	AgentRoleClient AgentRole = 0
	AgentRoleServer AgentRole = 1
)

type AgentState

type AgentState struct {
	StateToken string // 8 characters in the range [0-9A-Za-z]
	RequestId  uint64
}

type AgentTransport

type AgentTransport int
const (
	AgentTransportQUIC AgentTransport = iota + 1
	AgentTransportWebRTC
)

type ApplicationConnection

type ApplicationConnection interface {
	AcceptStream(context.Context) (ApplicationStream, error)
	OpenStreamSync(context.Context) (ApplicationStream, error)
	Close() error
}

Abstract connection for the application protocol.

type ApplicationStream

type ApplicationStream interface {
	io.ReadWriteCloser
}

Abstract stream for the application protocol.

type AuthenticationRole

type AuthenticationRole int
const (
	AuthenticationRolePresenter AuthenticationRole = 0
	AuthenticationRoleConsumer  AuthenticationRole = 1
)

func (AuthenticationRole) String

func (t AuthenticationRole) String() string

type Connection

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

Connection

func (*Connection) AcceptDataChannel

func (c *Connection) AcceptDataChannel(ctx context.Context) (*DataChannel, error)

AcceptStream accepts a data channel

func (*Connection) AcceptTransport

func (c *Connection) AcceptTransport(ctx context.Context) (*PooledWebTransport, error)

func (*Connection) Close

func (c *Connection) Close() error

Close the connection and all associated steams.

func (*Connection) LocalAgent

func (c *Connection) LocalAgent() *Agent

func (*Connection) NewTransport

func (c *Connection) NewTransport(ctx context.Context) (*PooledWebTransport, error)

NewTransport

func (*Connection) NewTransportListener

func (c *Connection) NewTransportListener() (*PooledWebTransport, error)

func (*Connection) OpenDataChannel

func (c *Connection) OpenDataChannel(ctx context.Context, params DataChannelParameters) (*DataChannel, error)

OpenDataChannel opens a data channel

func (*Connection) RemoteAgent

func (c *Connection) RemoteAgent() *Agent

type DTLSNetworkConnection

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

func NewDTLSNetworkConnection

func NewDTLSNetworkConnection(conn *dtls.Conn) *DTLSNetworkConnection

func (*DTLSNetworkConnection) Close

func (c *DTLSNetworkConnection) Close() error

func (*DTLSNetworkConnection) ConnectionState

func (c *DTLSNetworkConnection) ConnectionState() tls.ConnectionState

func (*DTLSNetworkConnection) IntoApplicationConnection

func (c *DTLSNetworkConnection) IntoApplicationConnection() (ApplicationConnection, error)

func (*DTLSNetworkConnection) IsReliable

func (c *DTLSNetworkConnection) IsReliable() bool

func (*DTLSNetworkConnection) Read

func (c *DTLSNetworkConnection) Read(p []byte) (int, error)

func (*DTLSNetworkConnection) Write

func (c *DTLSNetworkConnection) Write(p []byte) (int, error)

type DTLSNetworkListener

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

func (*DTLSNetworkListener) Accept

func (*DTLSNetworkListener) Addr

func (l *DTLSNetworkListener) Addr() net.Addr

type DTLSTransport

type DTLSTransport struct{}

func NewDTLSTransport

func NewDTLSTransport() *DTLSTransport

func (*DTLSTransport) DialAddr

func (t *DTLSTransport) DialAddr(ctx context.Context, addr string, tlsConf *tls.Config) (NetworkConnection, error)

func (*DTLSTransport) ListenAddr

func (t *DTLSTransport) ListenAddr(addr string, tlsConf *tls.Config) (NetworkListener, error)

type DataChannel

type DataChannel struct {
	DataChannelParameters
	// contains filtered or unexported fields
}

func (*DataChannel) Close

func (c *DataChannel) Close() error

Close closes the DataChannel and the underlying Quic stream.

func (*DataChannel) Read

func (c *DataChannel) Read(p []byte) (int, error)

Read reads a packet of len(p) bytes as binary data

func (*DataChannel) ReadDataChannel

func (c *DataChannel) ReadDataChannel(p []byte) (int, DataEncoding, error)

ReadDataChannel reads a packet of len(p) bytes

func (*DataChannel) ReceiveMessage

func (c *DataChannel) ReceiveMessage() ([]byte, error)

ReceiveMessage

func (*DataChannel) ReceiveMessageWithEncoding

func (c *DataChannel) ReceiveMessageWithEncoding() ([]byte, DataEncoding, error)

ReceiveMessageWithEncoding

func (*DataChannel) SendMessage

func (c *DataChannel) SendMessage(payload []byte) error

SendMessage

func (*DataChannel) SendMessageWithEncoding

func (c *DataChannel) SendMessageWithEncoding(payload []byte, enc DataEncoding) error

SendMessageWithEncoding

func (*DataChannel) Write

func (c *DataChannel) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p as binary data

func (*DataChannel) WriteDataChannel

func (c *DataChannel) WriteDataChannel(p []byte, enc DataEncoding) (n int, err error)

WriteDataChannel writes len(p) bytes from p

type DataChannelParameters

type DataChannelParameters struct {
	Label    string
	Protocol string
	ID       uint64
}

DataChannelParameters

type DataEncoding

type DataEncoding uint64

DataEncoding represents pre-agreed EncodingIds used in exchange-data.

type DiscoveredAgent

type DiscoveredAgent struct {
	PeerID PeerID
	TXT    TXTRecordSet
	// contains filtered or unexported fields
}

DiscoveredAgent represents a discovered remote agent that has not been contacted yet.

func (DiscoveredAgent) Dial

func (ra DiscoveredAgent) Dial(ctx context.Context, transportType AgentTransport, la *Agent) (*UnauthenticatedConnection, error)

Dial opens a connection to the remote agent.

func (*DiscoveredAgent) Nickname

func (a *DiscoveredAgent) Nickname() string

Nickname of the remote agent

type Discoverer

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

Discoverer is used to discover agents.

func Discover

func Discover() (*Discoverer, error)

Discover agents

func NewDiscoverer

func NewDiscoverer() *Discoverer

NewDiscoverer creates a new Discoverer

func (*Discoverer) Accept

func (d *Discoverer) Accept(ctx context.Context) (*DiscoveredAgent, error)

Accept returns an a discovered agent. It should be called in a loop.

func (*Discoverer) Close

func (d *Discoverer) Close() error

Close closes the discoverer. Any blocked Accept operations will be unblocked and return errors.

func (*Discoverer) Start

func (d *Discoverer) Start() error

Start discovering agents

func (*Discoverer) WithNickname

func (d *Discoverer) WithNickname(nickname string)

WithNickname defines a nickname of agents to discover.

type Listener

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

Listener acts as an advertising OSP agent and listens for incoming connections.

func Listen

func Listen(transportType AgentTransport, a *Agent) (*Listener, error)

Listen starts an advertising agent and listens for incoming connections.

func NewListener

func NewListener(a *Agent, transportType AgentTransport) *Listener

NewListener creates a new Listener

func (*Listener) Accept

Accept returns an a discovered agent. It should be called in a loop.

func (*Listener) Close

func (l *Listener) Close() error

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*Listener) ListenApplication

func (l *Listener) ListenApplication(alpn string, config *ALPNListenerConfig) *ALPNListener

ListenApplication allows you to listen for quic connections on the same port but with a different ALPN. Only one per ALPN is allowed. Needs to be registered before starting the Listener.

func (*Listener) Start

func (l *Listener) Start() error

type NetworkConnection

type NetworkConnection interface {
	io.ReadWriteCloser
	// Determines if this connection supports reliable delivery. If not, the
	// network protocol agent needs to perform timeout & retransmission.
	IsReliable() bool
	// Upgrades the connection to an application connection. Any proceeding
	// calls to the network connection will fail.
	IntoApplicationConnection() (ApplicationConnection, error)

	ConnectionState() tls.ConnectionState
}

Abstract connection for the network protocol, responsible for getting extended agent capabilities and performing the authentication ceremony.

type NetworkListener

type NetworkListener interface {
	Accept(ctx context.Context) (NetworkConnection, error)
	Addr() net.Addr
}

type NetworkTransport

type NetworkTransport interface {
	DialAddr(ctx context.Context, addr string, tlsConf *tls.Config) (NetworkConnection, error)
	ListenAddr(addr string, tlsConf *tls.Config) (NetworkListener, error)
}

func NewNetworkTransport

func NewNetworkTransport(typ AgentTransport) (NetworkTransport, error)

type PSKConfig

type PSKConfig struct {
	EaseOfInput int // 0-100
	Entropy     int // 20-60 bits
}

type PeerID

type PeerID string

PeerID is a unique identifier for a peer, it is equal tot the OSP agent fingerprint (FP) of the peer.

type PooledWebTransport

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

PooledWebTransport implements WebTransport pooled over an existing OpenScreenProtocol Application Transport.

func (*PooledWebTransport) AcceptStream

func (t *PooledWebTransport) AcceptStream(ctx context.Context) (*QuicStream, error)

func (*PooledWebTransport) CloseWithError

func (t *PooledWebTransport) CloseWithError(uint64, string) error

func (*PooledWebTransport) OpenStreamSync

func (t *PooledWebTransport) OpenStreamSync(ctx context.Context) (*QuicStream, error)

type QuicApplicationConnection

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

func (*QuicApplicationConnection) AcceptStream

func (*QuicApplicationConnection) Close

func (q *QuicApplicationConnection) Close() error

func (*QuicApplicationConnection) OpenStreamSync

type QuicApplicationStream

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

func (*QuicApplicationStream) Close

func (s *QuicApplicationStream) Close() error

func (*QuicApplicationStream) Read

func (s *QuicApplicationStream) Read(p []byte) (int, error)

func (*QuicApplicationStream) Write

func (s *QuicApplicationStream) Write(p []byte) (int, error)

type QuicNetworkConnection

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

func NewQuicNetworkConnection

func NewQuicNetworkConnection(conn quic.Connection) *QuicNetworkConnection

func (*QuicNetworkConnection) Close

func (q *QuicNetworkConnection) Close() error

func (*QuicNetworkConnection) ConnectionState

func (q *QuicNetworkConnection) ConnectionState() tls.ConnectionState

func (*QuicNetworkConnection) IntoApplicationConnection

func (q *QuicNetworkConnection) IntoApplicationConnection() (ApplicationConnection, error)

func (*QuicNetworkConnection) IsReliable

func (q *QuicNetworkConnection) IsReliable() bool

func (*QuicNetworkConnection) Read

func (q *QuicNetworkConnection) Read(p []byte) (int, error)

func (*QuicNetworkConnection) Write

func (q *QuicNetworkConnection) Write(p []byte) (int, error)

type QuicNetworkListener

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

func (*QuicNetworkListener) Accept

func (*QuicNetworkListener) Addr

func (l *QuicNetworkListener) Addr() net.Addr

type QuicStream

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

Stream

func (*QuicStream) Close

func (s *QuicStream) Close() error

func (*QuicStream) Read

func (s *QuicStream) Read(p []byte) (int, error)

func (*QuicStream) StreamID

func (s *QuicStream) StreamID() int64

func (*QuicStream) Write

func (s *QuicStream) Write(p []byte) (n int, err error)

type QuicTransport

type QuicTransport struct{}

func NewQuicTransport

func NewQuicTransport() *QuicTransport

func (*QuicTransport) DialAddr

func (t *QuicTransport) DialAddr(ctx context.Context, addr string, tlsConf *tls.Config) (NetworkConnection, error)

func (*QuicTransport) ListenAddr

func (t *QuicTransport) ListenAddr(addr string, tlsConf *tls.Config) (NetworkListener, error)

type SCTPApplicationConnection

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

func (*SCTPApplicationConnection) AcceptStream

func (*SCTPApplicationConnection) Close

func (c *SCTPApplicationConnection) Close() error

func (*SCTPApplicationConnection) OpenStreamSync

type SCTPApplicationStream

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

func NewSCTPApplicationStream

func NewSCTPApplicationStream(stream *sctp.Stream) *SCTPApplicationStream

func (*SCTPApplicationStream) Close

func (s *SCTPApplicationStream) Close() error

func (*SCTPApplicationStream) Read

func (s *SCTPApplicationStream) Read(p []byte) (int, error)

func (*SCTPApplicationStream) Write

func (s *SCTPApplicationStream) Write(p []byte) (int, error)

type TXTRecordSet

type TXTRecordSet map[string][]string

func (TXTRecordSet) Add

func (r TXTRecordSet) Add(key, value string)

func (TXTRecordSet) FromSlice

func (r TXTRecordSet) FromSlice(in []string) error

func (TXTRecordSet) Get

func (r TXTRecordSet) Get(key string) []string

func (TXTRecordSet) GetOne

func (r TXTRecordSet) GetOne(key string) (string, error)

func (TXTRecordSet) Set

func (r TXTRecordSet) Set(key, value string)

func (TXTRecordSet) ToSlice

func (r TXTRecordSet) ToSlice() []string

type TransportListener

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

func (*TransportListener) Accept

func (*TransportListener) Close

func (l *TransportListener) Close() error

type TypeKey

type TypeKey uint64

type UnauthenticatedConnection

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

UnauthenticatedConnection represents an OSPC connection that didn't pass authentication yet.

func (*UnauthenticatedConnection) AcceptAuthenticate

func (c *UnauthenticatedConnection) AcceptAuthenticate(ctx context.Context) (role AuthenticationRole, err error)

AcceptAuthenticate is used to handle an incoming authentication request. It has to be called for every UnauthenticatedConnection.

func (*UnauthenticatedConnection) AuthenticatePSK

func (c *UnauthenticatedConnection) AuthenticatePSK(ctx context.Context, psk []byte) (*Connection, error)

Authenticate is used to authenticate. It will block until authentication is complete or the context is closed.

func (*UnauthenticatedConnection) Close

func (c *UnauthenticatedConnection) Close() error

Close the unauthenticated connection. If the connection has progressed to authenticated, it is not closed but an error is returned. This allows for defer closing regardless.

func (*UnauthenticatedConnection) GeneratePSK

func (c *UnauthenticatedConnection) GeneratePSK() ([]byte, error)

GeneratePSK creates a PSK based on the negotiated config.

func (*UnauthenticatedConnection) GetAuthenticationRole

func (c *UnauthenticatedConnection) GetAuthenticationRole() AuthenticationRole

GetAuthenticationRole determines if the agent should act as presenter or consumer of the PSK.

func (*UnauthenticatedConnection) LocalAgent

func (c *UnauthenticatedConnection) LocalAgent() *Agent

LocalAgent provides info about local agent

func (*UnauthenticatedConnection) RemoteAgent

func (c *UnauthenticatedConnection) RemoteAgent() *Agent

RemoteAgent provides info about remote agent

func (*UnauthenticatedConnection) RequestAuthenticatePSK

func (c *UnauthenticatedConnection) RequestAuthenticatePSK() error

RequestAuthenticatePSK is used to request authentication as an initiating collector agent.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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