service

package
v0.0.0-...-9e73b81 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Method = "chacha20-ietf-poly1305"

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	GetConnections(ctx context.Context, userId int64) ([]entity.Connection, error)
	CreateConnection(ctx context.Context, usr *entity.User, serverId int) (int, error)
}

type ConnectionService

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

func NewConnectionService

func NewConnectionService(repo repository.Connection, crypto Crypto) *ConnectionService

func (*ConnectionService) CreateConnection

func (c *ConnectionService) CreateConnection(ctx context.Context, usr *entity.User, serverId int) (int, error)

func (*ConnectionService) GetConnections

func (c *ConnectionService) GetConnections(ctx context.Context, userId int64) ([]entity.Connection, error)

type Crypto

type Crypto interface {
	Encrypt(text, key string) (string, error)
	Decrypt(cipherText, key string) (string, error)
	GeneratePassword(passwordLen int) string
	GenerateSSConfig(conn *entity.Connection, cnf struct {
		// contains filtered or unexported fields
	}) (string, error)
}

type CryptoService

type CryptoService struct{}

func (CryptoService) Decrypt

func (c CryptoService) Decrypt(cipherText, key string) (string, error)

func (CryptoService) Encrypt

func (c CryptoService) Encrypt(text, key string) (string, error)

Encrypt service - key must be 16, 24 or 32 length

func (CryptoService) GeneratePassword

func (c CryptoService) GeneratePassword(passwordLen int) string

func (CryptoService) GenerateSSConfig

func (c CryptoService) GenerateSSConfig(conn *entity.Connection, cnf struct{ key, name string }) (string, error)

GenerateSSConfig - key must be 16, 24 or 32 length

type Service

type Service struct {
	Connection
}

func NewService

func NewService(repos *repository.Repository) *Service

Jump to

Keyboard shortcuts

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