store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PermissionDenied = status.Error(codes.PermissionDenied, "permission denied")
View Source
var ServiceNotFound = status.Error(codes.NotFound, "service not found")

Functions

func NewDBStore

func NewDBStore(dc DatabaseConfig, serverHostPort string) (*gorm_store, error)

Types

type Binding

type Binding struct {
	ID             string `gorm:"primaryKey"`
	ServiceID      string `gorm:"index:"`
	ServerHostPort string
	ServerID       string
	CreatedAt      time.Time `gorm:"default:now()"`
	From           string
}

type DatabaseConfig

type DatabaseConfig interface {
	Dialector() gorm.Dialector
}

type ImportConfig

type ImportConfig struct {
	Name                 string   `yaml:"name"`
	Listen               string   `yaml:"listen"`
	AllowedListenTokens  []string `yaml:"allowed-listen-tokens"`
	AllowedConnectTokens []string `yaml:"allowed-connect-tokens"`
}

type PostgresConfig

type PostgresConfig struct {
	Host     string
	Port     int
	SslMode  string
	Database string
	User     string
	Password string
}

func DefaultPostgresConfig

func DefaultPostgresConfig() PostgresConfig

func (PostgresConfig) Dialector

func (d PostgresConfig) Dialector() gorm.Dialector

type Server

type Server struct {
	ID             string `gorm:"primaryKey"`
	ServerHostPort string
	CreatedAt      time.Time `gorm:"default:now()"`
	AliveAt        time.Time `gorm:"default:now()"`
}

type Service

type Service struct {
	ID               string         `gorm:"primaryKey"`
	AllowedToListen  pq.StringArray `gorm:"type:text[]"`
	AllowedToConnect pq.StringArray `gorm:"type:text[]"`
	Owner            string
}

type Store

type Store interface {
	Start() error
	Stop()
	OnListen(service string, token string, from string) (redirect string, close func(), err error)
	OnConnect(service string, token string, from string) (redirect string, close func(), err error)
}

func NewDirStore

func NewDirStore(dsn string) (Store, error)

Jump to

Keyboard shortcuts

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