Documentation
¶
Overview ¶
Package kamune provides secure communication over untrusted networks.
Index ¶
- Variables
- func Bytes(b []byte) *wrapperspb.BytesValue
- type ChatEntry
- type Conn
- type ConnOption
- type DialOption
- func DialWithAlgorithm(a attest.Algorithm) DialOption
- func DialWithClientName(name string) DialOption
- func DialWithDialTimeout(timeout time.Duration) DialOption
- func DialWithExistingConn(conn Conn) DialOption
- func DialWithReadTimeout(timeout time.Duration) DialOption
- func DialWithRemoteVerifier(verifier RemoteVerifier) DialOption
- func DialWithStorageOpts(opts ...StorageOption) DialOption
- func DialWithTCPConn(opts ...ConnOption) DialOption
- func DialWithUDPConn(opts ...ConnOption) DialOption
- func DialWithWriteTimeout(timeout time.Duration) DialOption
- type Dialer
- type HandlerFunc
- type Metadata
- type PassphraseHandler
- type Peer
- type PublicKey
- type RemoteVerifier
- type Sender
- type Server
- type ServerOptions
- func ServeWithAlgorithm(a attest.Algorithm) ServerOptions
- func ServeWithName(name string) ServerOptions
- func ServeWithRemoteVerifier(remote RemoteVerifier) ServerOptions
- func ServeWithStorageOpts(opts ...StorageOption) ServerOptions
- func ServeWithTCP(opts ...ConnOption) ServerOptions
- func ServeWithUDP(opts ...ConnOption) ServerOptions
- type Storage
- func (s *Storage) AddChatEntry(sessionID string, payload []byte, ts time.Time, sender Sender) error
- func (s *Storage) Close() error
- func (s *Storage) FindPeer(claim []byte) (*Peer, error)
- func (s *Storage) GetChatHistory(sessionID string) ([]ChatEntry, error)
- func (s *Storage) StorePeer(peer *Peer) error
- type StorageOption
- func StorageWithAlgorithm(algorithm attest.Algorithm) StorageOption
- func StorageWithDBPath(path string) StorageOption
- func StorageWithExpiryDuration(duration time.Duration) StorageOption
- func StorageWithNoPassphrase() StorageOption
- func StorageWithPassphraseHandler(fn PassphraseHandler) StorageOption
- type Transferable
- type Transport
Constants ¶
This section is empty.
Variables ¶
var ( ErrConnClosed = errors.New("connection has been closed") ErrInvalidSignature = errors.New("invalid signature") ErrVerificationFailed = errors.New("verification failed") ErrMessageTooLarge = errors.New("message is too large") ErrOutOfSync = errors.New("peers are out of sync") )
var (
ErrMissingChatBucket = errors.New("chat bucket not found")
)
var (
ErrPeerExpired = errors.New("peer has been expired")
)
Functions ¶
func Bytes ¶
func Bytes(b []byte) *wrapperspb.BytesValue
Types ¶
type ConnOption ¶
type ConnOption func(*conn) error
func ConnWithReadTimeout ¶
func ConnWithReadTimeout(timeout time.Duration) ConnOption
func ConnWithWriteTimeout ¶
func ConnWithWriteTimeout(timeout time.Duration) ConnOption
type DialOption ¶
type DialOption func(*Dialer)
func DialWithAlgorithm ¶
func DialWithAlgorithm(a attest.Algorithm) DialOption
func DialWithClientName ¶
func DialWithClientName(name string) DialOption
func DialWithDialTimeout ¶
func DialWithDialTimeout(timeout time.Duration) DialOption
func DialWithExistingConn ¶
func DialWithExistingConn(conn Conn) DialOption
func DialWithReadTimeout ¶
func DialWithReadTimeout(timeout time.Duration) DialOption
func DialWithRemoteVerifier ¶
func DialWithRemoteVerifier(verifier RemoteVerifier) DialOption
func DialWithStorageOpts ¶
func DialWithStorageOpts(opts ...StorageOption) DialOption
func DialWithTCPConn ¶
func DialWithTCPConn(opts ...ConnOption) DialOption
func DialWithUDPConn ¶
func DialWithUDPConn(opts ...ConnOption) DialOption
func DialWithWriteTimeout ¶
func DialWithWriteTimeout(timeout time.Duration) DialOption
type HandlerFunc ¶
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
func (Metadata) SequenceNum ¶
type PassphraseHandler ¶
type RemoteVerifier ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer( addr string, handler HandlerFunc, opts ...ServerOptions, ) (*Server, error)
func (*Server) ListenAndServe ¶
type ServerOptions ¶
type ServerOptions func(*Server)
func ServeWithAlgorithm ¶
func ServeWithAlgorithm(a attest.Algorithm) ServerOptions
func ServeWithName ¶
func ServeWithName(name string) ServerOptions
func ServeWithRemoteVerifier ¶
func ServeWithRemoteVerifier(remote RemoteVerifier) ServerOptions
func ServeWithStorageOpts ¶
func ServeWithStorageOpts(opts ...StorageOption) ServerOptions
func ServeWithTCP ¶
func ServeWithTCP(opts ...ConnOption) ServerOptions
func ServeWithUDP ¶
func ServeWithUDP(opts ...ConnOption) ServerOptions
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func OpenStorage ¶
func OpenStorage(opts ...StorageOption) (*Storage, error)
func (*Storage) AddChatEntry ¶
func (s *Storage) AddChatEntry( sessionID string, payload []byte, ts time.Time, sender Sender, ) error
AddChatEntry stores a chat message for the given session ID. The message is stored in a bucket named "chat_<sessionID>" and the key begins with an 8-byte big-endian uint64 representation of the timestamp's UnixNano value. 2 bytes are used for the sender identity. Currently, 0 means local user, 1 means remote user. To avoid collisions when two messages have the same timestamp, a 4-byte random suffix is appended to the key to avoid collision. The session ID is used as the bucket name, which scopes entries per session. If the provided timestamp is zero, the current time is used.
func (*Storage) GetChatHistory ¶
GetChatHistory returns decrypted chat entries stored under a bucket specific to the session ID. The bucket name used is "chat_<sessionID>" and keys are expected to be 14 bytes total, composed of:
- 8 bytes: UnixNano timestamp (big-endian)
- 2 bytes: sender ID (big-endian; 0 means local user, 1 means remote user)
- 4 bytes: random suffix to avoid collision
type StorageOption ¶
type StorageOption func(*Storage)
func StorageWithAlgorithm ¶
func StorageWithAlgorithm(algorithm attest.Algorithm) StorageOption
func StorageWithDBPath ¶
func StorageWithDBPath(path string) StorageOption
func StorageWithExpiryDuration ¶
func StorageWithExpiryDuration(duration time.Duration) StorageOption
func StorageWithNoPassphrase ¶
func StorageWithNoPassphrase() StorageOption
func StorageWithPassphraseHandler ¶
func StorageWithPassphraseHandler(fn PassphraseHandler) StorageOption
