types

package
v0.0.0-...-69b9976 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashCost = 14
)

Variables

View Source
var (
	ErrNotFound           = errors.New("object not found")
	ErrAlreadyExists      = errors.New("object already exists")
	ErrCastingObject      = errors.New("error casting object")
	ErrInvalidPeerID      = errors.New("invalid peer id")
	ErrInvalidPublicKey   = errors.New("invalid public key")
	ErrInvalidRegisterKey = errors.New("invalid register key")
	ErrInvalidEndpoint    = errors.New("invalid endpoint")
)

Functions

This section is empty.

Types

type Peer

type Peer struct {
	ID        uint32 `gorm:"primaryKey,autoIncrement"`
	PublicKey string `gorm:"uniqueIndex,not null"`
	IP        string `gorm:"uniqueIndex,not null"`
	Endpoint  string
	Connected bool `gorm:"index"`

	CreatedAt time.Time
	UpdatedAt time.Time
}

func NewPeer

func NewPeer(id uint32, key string, ip string, endpoint string) *Peer

func (*Peer) Copy

func (p *Peer) Copy() Peer

func (*Peer) Proto

func (p *Peer) Proto() *controllerv1.Peer

func (*Peer) ProtoConfig

func (p *Peer) ProtoConfig() *controllerv1.PeerConfig

type User

type User struct {
	gorm.Model
	Username     string `gorm:"uniqueIndex"`
	PasswordHash []byte
	Active       bool
}

func NewUser

func NewUser(username, password string) (*User, error)

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

TODO: temporary fallback until Oauth/openid implemented

Jump to

Keyboard shortcuts

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