interfaces

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const NextProtoAbyss = "abyss"

TLS ALPN code

Variables

This section is empty.

Functions

This section is empty.

Types

type ANDERROR

type ANDERROR int
const (
	EINVAL ANDERROR //invalid argument
	EPANIC          //unrecoverable internal error (must not occur)
)

type ANDFullPeerSessionIdentity added in v0.0.24

type ANDFullPeerSessionIdentity struct {
	AURL                       *aurl.AURL
	SessionID                  uuid.UUID
	TimeStamp                  time.Time
	RootCertificateDer         []byte
	HandshakeKeyCertificateDer []byte
}

type ANDPeerSession

type ANDPeerSession struct {
	Peer          IANDPeer
	PeerSessionID uuid.UUID
}

type ANDPeerSessionIdentity added in v0.0.24

type ANDPeerSessionIdentity struct {
	PeerHash  string
	SessionID uuid.UUID
}

type ANDPeerSessionWithTimeStamp added in v0.0.24

type ANDPeerSessionWithTimeStamp struct {
	ANDPeerSession
	TimeStamp time.Time
}

type AbystInboundSession

type AbystInboundSession struct {
	PeerHash   string
	Connection quic.Connection
}

type EMemberObjectAppend added in v0.0.19

type EMemberObjectAppend struct {
	PeerHash string
	Objects  []ObjectInfo
}

type EMemberObjectDelete added in v0.0.19

type EMemberObjectDelete struct {
	PeerHash  string
	ObjectIDs []uuid.UUID
}

type EWorldMemberLeave added in v0.0.19

type EWorldMemberLeave struct {
	PeerHash string
}

type EWorldMemberReady added in v0.0.19

type EWorldMemberReady struct {
	Member IWorldMember
}

type EWorldMemberRequest added in v0.0.19

type EWorldMemberRequest struct {
	MemberHash string
	Accept     func()
	Decline    func(code int, message string)
}

type EWorldTerminate

type EWorldTerminate struct{}

type IANDPeer

type IANDPeer interface {
	IDHash() string
	RootCertificateDer() []byte
	HandshakeKeyCertificateDer() []byte

	IsConnected() bool
	AURL() *aurl.AURL

	//inactivity check
	Context() context.Context
	Activate()
	Renew()
	Deactivate()
	Error() error

	AhmpCh() chan any

	TrySendJN(local_session_id uuid.UUID, path string, timestamp time.Time) bool
	TrySendJOK(local_session_id uuid.UUID, peer_session_id uuid.UUID, timestamp time.Time, world_url string, member_sessions []ANDPeerSessionWithTimeStamp) bool
	TrySendJDN(peer_session_id uuid.UUID, code int, message string) bool
	TrySendJNI(local_session_id uuid.UUID, peer_session_id uuid.UUID, member_session ANDPeerSessionWithTimeStamp) bool
	TrySendMEM(local_session_id uuid.UUID, peer_session_id uuid.UUID, timestamp time.Time) bool
	TrySendSJN(local_session_id uuid.UUID, peer_session_id uuid.UUID, member_sessions []ANDPeerSessionIdentity) bool
	TrySendCRR(local_session_id uuid.UUID, peer_session_id uuid.UUID, member_sessions []ANDPeerSessionIdentity) bool
	TrySendRST(local_session_id uuid.UUID, peer_session_id uuid.UUID) bool

	TrySendSOA(local_session_id uuid.UUID, peer_session_id uuid.UUID, objects []ObjectInfo) bool
	TrySendSOD(local_session_id uuid.UUID, peer_session_id uuid.UUID, objectIDs []uuid.UUID) bool
}

type IAbyssHost

type IAbyssHost interface {
	GetLocalAbyssURL() *aurl.AURL

	OpenOutboundConnection(abyss_url *aurl.AURL)

	//Abyss
	OpenWorld(web_url string) (IAbyssWorld, error)
	JoinWorld(ctx context.Context, abyss_url *aurl.AURL) (IAbyssWorld, error)
	LeaveWorld(world IAbyssWorld) //this does not wait for world-related resource cleanup.

	//Abyst
	GetAbystClientConnection(peer_hash string) (*http3.ClientConn, error)
}

type IAbyssWorld

type IAbyssWorld interface {
	SessionID() uuid.UUID
	URL() string
	GetEventChannel() chan any
}

type IAddressSelector

type IAddressSelector interface {
	LocalPrivateIPAddr() net.IP
	FilterAddressCandidates(addresses []*net.UDPAddr) []*net.UDPAddr
}

type IHostIdentity

type IHostIdentity interface {
	IDHash() string
	RootCertificate() string         //pem
	HandshakeKeyCertificate() string //pem
}

type INeighborDiscovery

type INeighborDiscovery interface {
	EventChannel() chan NeighborEvent

	//calls
	PeerConnected(peer IANDPeer) ANDERROR
	PeerClose(peer IANDPeer) ANDERROR
	OpenWorld(local_session_id uuid.UUID, world_url string) ANDERROR
	JoinWorld(local_session_id uuid.UUID, abyss_url *aurl.AURL) ANDERROR
	AcceptSession(local_session_id uuid.UUID, peer_session ANDPeerSession) ANDERROR
	DeclineSession(local_session_id uuid.UUID, peer_session ANDPeerSession, code int, message string) ANDERROR
	CloseWorld(local_session_id uuid.UUID) ANDERROR
	TimerExpire(local_session_id uuid.UUID) ANDERROR

	//ahmp messages
	JN(local_session_id uuid.UUID, peer_session ANDPeerSession, timestamp time.Time) ANDERROR
	JOK(local_session_id uuid.UUID, peer_session ANDPeerSession, timestamp time.Time, world_url string, member_sessions []ANDFullPeerSessionIdentity) ANDERROR
	JDN(local_session_id uuid.UUID, peer IANDPeer, code int, message string) ANDERROR
	JNI(local_session_id uuid.UUID, peer_session ANDPeerSession, member_session ANDFullPeerSessionIdentity) ANDERROR
	MEM(local_session_id uuid.UUID, peer_session ANDPeerSession, timestamp time.Time) ANDERROR
	SJN(local_session_id uuid.UUID, peer_session ANDPeerSession, member_infos []ANDPeerSessionIdentity) ANDERROR
	CRR(local_session_id uuid.UUID, peer_session ANDPeerSession, member_infos []ANDPeerSessionIdentity) ANDERROR
	RST(local_session_id uuid.UUID, peer_session ANDPeerSession) ANDERROR

	SOA(local_session_id uuid.UUID, peer_session ANDPeerSession, objects []ObjectInfo) ANDERROR
	SOD(local_session_id uuid.UUID, peer_session ANDPeerSession, objectIDs []uuid.UUID) ANDERROR
}

type INetworkService

type INetworkService interface {
	LocalIdentity() IHostIdentity
	LocalAURL() *aurl.AURL

	HandlePreAccept(preaccept_handler IPreAccepter) // if false, return status code and message

	ListenAndServe() error

	AppendKnownPeer(root_cert string, handshake_key_cert string) error
	AppendKnownPeerDer(root_cert []byte, handshake_key_cert []byte) error

	GetAbyssPeerChannel() chan IANDPeer //wait for established abyss mutual connection

	ConnectAbyssAsync(url *aurl.AURL) error                 //may return error if peer information has expired.
	ConnectAbyst(peer_hash string) (quic.Connection, error) //should take ~2 rtt.
}

1. AbyssAsync 'always' succeeds, resulting in IANDPeer -> if connection failed, IANDPeer methods return error. 2. Abyst may fail at any moment

type IPathResolver

type IPathResolver interface {
	PathToSessionID(path string, peer_hash string) (uuid.UUID, bool)
}

type IPreAccepter

type IPreAccepter interface {
	PreAccept(peer_hash string, address *net.UDPAddr) (bool, int, string)
}

type IWorldMember added in v0.0.19

type IWorldMember interface {
	Hash() string
	SessionID() uuid.UUID
	AppendObjects(objects []ObjectInfo) bool
	DeleteObjects(objectIDs []uuid.UUID) bool
}

type NeighborEvent

type NeighborEvent struct {
	Type           NeighborEventType
	LocalSessionID uuid.UUID
	ANDPeerSession
	Text   string
	Value  int
	Object any
}

type NeighborEventType

type NeighborEventType int
const (
	ANDSessionRequest NeighborEventType = iota + 2
	ANDSessionReady
	ANDSessionClose
	ANDJoinSuccess
	ANDJoinFail
	ANDWorldLeave //called after WorldLeave
	ANDConnectRequest
	ANDTimerRequest
	ANDPeerRegister

	ANDObjectAppend
	ANDObjectDelete
	ANDNeighborEventDebug
)

type ObjectInfo

type ObjectInfo struct {
	ID        uuid.UUID
	Addr      string
	Transform [7]float32
}

type PeerCertificates

type PeerCertificates struct {
	RootCertDer         []byte
	HandshakeKeyCertDer []byte
}

Jump to

Keyboard shortcuts

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