server

package
v0.0.0-...-b5a4de9 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveServerID

func DeriveServerID(pub []byte) string

func LoadFederationTLSConfig

func LoadFederationTLSConfig(certFile, keyFile, caFile string) (*tls.Config, error)

func LoadPeers

func LoadPeers(path string) ([]types.PeerConfig, error)

Types

type Bootstrap

type Bootstrap struct {
	Cfg        config.ServerConfig
	DB         *pgxpool.Pool
	Statements *ServerDB

	Strike       *StrikeServer
	Orchestrator *FederationOrchestrator
	// contains filtered or unexported fields
}

func InitBootstrap

func InitBootstrap(cfg config.ServerConfig) *Bootstrap

func (*Bootstrap) InitDb

func (b *Bootstrap) InitDb(ctx context.Context) error

func (*Bootstrap) InitFederation

func (b *Bootstrap) InitFederation() error

func (*Bootstrap) InitFederationTLS

func (b *Bootstrap) InitFederationTLS() (*tls.Config, error)

func (*Bootstrap) InitStrikeServer

func (b *Bootstrap) InitStrikeServer(creds credentials.TransportCredentials, peers []types.PeerConfig) error

func (*Bootstrap) Start

func (b *Bootstrap) Start(ctx context.Context) error

func (*Bootstrap) Stop

func (b *Bootstrap) Stop(ctx context.Context)

type FederationOrchestrator

type FederationOrchestrator struct {
	pb.UnimplementedFederationServer
	// contains filtered or unexported fields
}

func NewFederationOrchestrator

func NewFederationOrchestrator(s *StrikeServer) *FederationOrchestrator

func (*FederationOrchestrator) Handshake

func (fo *FederationOrchestrator) Handshake(
	ctx context.Context,
	req *pb.HandshakeReq,
) (*pb.HandshakeAck, error)

func (*FederationOrchestrator) Relay

type Identity

type Identity struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

func InitID

func InitID(svrCfg config.ServerConfig, idCfg string) (*Identity, error)

type PeerManager

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

func NewPeerManager

func NewPeerManager(peers map[string]*types.Peer) *PeerManager

func (*PeerManager) Client

func (pm *PeerManager) Client(peerID string) (fedpb.FederationClient, bool)

func (*PeerManager) ConnectAll

func (pm *PeerManager) ConnectAll(
	ctx context.Context,
	tlsConf *tls.Config,
	localID string,
	localName string,
)

type ServerDB

type ServerDB struct {
	User struct {
		CreateUser string
		LoginUser  string
		GetUser    string
		SaltMine   string
	}

	Keys struct {
		GetPublicKeys    string
		CreatePublicKeys string
	}
}

func PrepareStatements

func PrepareStatements(ctx context.Context, dbpool *pgxpool.Pool) (*ServerDB, error)

type StrikeServer

type StrikeServer struct {
	pb.UnimplementedStrikeServer

	ID   uuid.UUID
	Name string

	PeerMgr *PeerManager

	DBpool      *pgxpool.Pool
	PStatements *ServerDB

	Pending map[uuid.UUID]*types.PendingMsg

	RemotePresence map[uuid.UUID]string
	// contains filtered or unexported fields
}

func (*StrikeServer) EnqueueFederated

func (s *StrikeServer) EnqueueFederated(ctx context.Context, rp *fedpb.RelayPayload) error

func (*StrikeServer) Login

func (s *StrikeServer) Login(ctx context.Context, clientLogin *pb.LoginVerify) (*pb.ServerResponse, error)

func (*StrikeServer) SaltMine

func (s *StrikeServer) SaltMine(ctx context.Context, userInfo *common_pb.UserInfo) (*pb.Salt, error)

func (*StrikeServer) SendPayload

func (s *StrikeServer) SendPayload(ctx context.Context, payload *pb.StreamPayload) (*pb.ServerResponse, error)

func (*StrikeServer) Signup

func (s *StrikeServer) Signup(ctx context.Context, userInit *pb.InitUser) (*pb.ServerResponse, error)

func (*StrikeServer) UpdateRemotePresence

func (s *StrikeServer) UpdateRemotePresence(user uuid.UUID, peerID string)

func (*StrikeServer) UserRequest

func (s *StrikeServer) UserRequest(ctx context.Context, userInfo *common_pb.UserInfo) (*common_pb.UserInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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