server

package
v0.0.0-...-2e2ebad Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identity

type Identity struct {
	ServerName     string               `json:"servername,omitempty"`
	ServerDesc     string               `json:"serverdesc,omitempty"`
	ServerKp       meowlib.KeyPair      `json:"server_kp,omitempty"`
	Status         string               `json:"status,omitempty"`
	OwnerName      string               `json:"owner_name,omitempty"`
	OwnerPublicKey string               `json:"owner_public_key,omitempty"`
	ArchiveClients []string             `json:"archive_clients,omitempty"`
	KnownServers   []meowlib.ServerCard `json:"known_servers,omitempty"`
}

func CreateIdentity

func CreateIdentity(ServerName string, ServerDesc string) *Identity

func LoadIdentity

func LoadIdentity(File string) (*Identity, error)

func (*Identity) AsymDecryptMessage

func (id *Identity) AsymDecryptMessage(ClientPublicKey string, Message []byte, Signature []byte) (DecryptedMsg []byte, err error)

AsymDecryptMessage reads a message from a specific client contact

func (*Identity) AsymEncryptMessage

func (id *Identity) AsymEncryptMessage(peerPublicKey string, Message []byte) (*meowlib.EncryptedMessage, error)

AsymEncryptMessage prepares a message to send to a specific peer contact

func (*Identity) BuildSimpleAckResponseMessage

func (id *Identity) BuildSimpleAckResponseMessage(uuidToAck string) (fromServerMessage *meowlib.FromServerMessage, err error)

func (*Identity) DeserializeToServerMessage

func (id *Identity) DeserializeToServerMessage(toServerMessage []byte) (*meowlib.ToServerMessage, error)

Decode decrypted ToServerMessage

func (*Identity) PackForSending

func (id *Identity) PackForSending(encryptedMessage []byte, signature []byte) (fromServerMessage []byte, err error)

func (*Identity) ProcessInbound

func (id *Identity) ProcessInbound(message []byte) (*meowlib.ToServerMessage, error)

Inbound helper function

func (*Identity) ProcessOutbound

func (id *Identity) ProcessOutbound(peerPublicKey string, msg *meowlib.FromServerMessage) (fromServerMessage []byte, err error)

Outbound helper function

func (*Identity) Save

func (id *Identity) Save(file string) error

func (*Identity) SerializeFromServerMessage

func (id *Identity) SerializeFromServerMessage(msg *meowlib.FromServerMessage) (encodedFromServerMessage []byte, err error)

func (*Identity) UnpackReceived

func (id *Identity) UnpackReceived(message []byte) (fromPublicKey string, encryptedMessage []byte, signature []byte, err error)

Unpack a protobuf received packed message

type RedisRouter

type RedisRouter struct {
	Name              string
	ServerIdentity    *Identity
	Client            *redis.Client
	InvitationTimeout int
	Context           context.Context
}

func NewRedisRouter

func NewRedisRouter(server *Identity, redisUrl string, password string, db int, invitationTimeout int) *RedisRouter

func (*RedisRouter) GetAnswerToInvitation

func (r *RedisRouter) GetAnswerToInvitation(id string) ([]byte, error)

func (*RedisRouter) GetInvitation

func (r *RedisRouter) GetInvitation(id string, password string) ([]byte, error)

func (*RedisRouter) Route

func (*RedisRouter) StoreAnswerToInvitation

func (r *RedisRouter) StoreAnswerToInvitation(id string, timeout int, invitation []byte, serverTimeout int) time.Time

func (*RedisRouter) StoreInvitation

func (r *RedisRouter) StoreInvitation(invitation []byte, timeout int, password string, serverTimeout int, urlLen int) (string, time.Time)

Jump to

Keyboard shortcuts

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