session

package
v0.0.0-...-941dc1b Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: 2023 Jon Lundy <jon@xuu.cc> SPDX-License-Identifier: BSD-3-Clause

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist = errors.New("does not exist")
	ErrInternal = errors.New("internal error")
)

Functions

This section is empty.

Types

type DiskSessionManager

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

func NewSessionManager

func NewSessionManager(path, me string, key *keys.EdX25519Key) (*DiskSessionManager, func() error, error)

func (*DiskSessionManager) ByName

func (sm *DiskSessionManager) ByName(name string) ulid.ULID

func (*DiskSessionManager) Close

func (sm *DiskSessionManager) Close() error

func (*DiskSessionManager) Delete

func (sm *DiskSessionManager) Delete(sess *Session) error

func (*DiskSessionManager) Get

func (sm *DiskSessionManager) Get(id ulid.ULID) (*Session, error)

func (*DiskSessionManager) Identity

func (sm *DiskSessionManager) Identity() *keys.EdX25519Key

func (*DiskSessionManager) Load

func (sm *DiskSessionManager) Load() error

func (*DiskSessionManager) New

func (sm *DiskSessionManager) New(them string) (*Session, error)

func (*DiskSessionManager) Position

func (sm *DiskSessionManager) Position() int64

func (*DiskSessionManager) Put

func (sm *DiskSessionManager) Put(sess *Session) error

func (*DiskSessionManager) Sessions

func (sm *DiskSessionManager) Sessions() []Pair[string, ulid.ULID]

func (*DiskSessionManager) SetPosition

func (sm *DiskSessionManager) SetPosition(pos int64)

type Pair

type Pair[K, V any] struct {
	Name K
	ID   V
}

type Session

type Session struct {
	Name     string
	PeerKey  *keys.EdX25519PublicKey
	Endpoint string

	PendingAck string

	*xochimilco.Session
}

func NewSession

func NewSession(id ulid.ULID, me string, key *keys.EdX25519Key, name string, them saltyim.Addr) *Session

func (*Session) MarshalBinary

func (s *Session) MarshalBinary() ([]byte, error)

func (*Session) Offer

func (s *Session) Offer() (string, error)

func (*Session) ReceiveMsg

func (s *Session) ReceiveMsg(msg xochimilco.Msg) (isEstablished, isClosed bool, plaintext []byte, err error)

func (*Session) SetPeerKey

func (s *Session) SetPeerKey(name string, p []byte)

func (*Session) UnmarshalBinary

func (s *Session) UnmarshalBinary(b []byte) error

Directories

Path Synopsis
SPDX-FileCopyrightText: 2023 Jon Lundy <jon@xuu.cc> SPDX-License-Identifier: BSD-3-Clause
SPDX-FileCopyrightText: 2023 Jon Lundy <jon@xuu.cc> SPDX-License-Identifier: BSD-3-Clause

Jump to

Keyboard shortcuts

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