utrojan

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 16 Imported by: 0

README

Ulysses.Trojan - Trojan Account Management Module

Ulysses.Trojan is an Ulysses-compatible implementation of Trojan Account Management Module.

Implemented Ulysses Interfaces

  • Ulysses/src/server.AccountUsage as AccountUsage{}
  • Ulysses/src/server.Credential as Credential{}
  • Ulysses/src/server.Server as *Server{}
  • Ulysses/src/server.ServerRegistrar as *ServerRegistrar{}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProvisioningServer

func NewProvisioningServer(instanceID string, serverConfiguration interface{}) (server.ProvisioningServer, error)

Types

type Account

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

func (*Account) Credentials

func (a *Account) Credentials() (server.Credentials, error)

func (*Account) Resources

func (a *Account) Resources() ([]*server.Resource, error)

type AccountConfiguration

type AccountConfiguration struct {
	Password string  `json:"password"`
	Quota    float64 `json:"quota"` // in GB
}

func ParseAccountConfiguration

func ParseAccountConfiguration(config interface{}) (ac AccountConfiguration, err error)

func (AccountConfiguration) PasswordEncrypted

func (ac AccountConfiguration) PasswordEncrypted() string

PasswordEncrypted() returns the password encrypted by the managed security module.

func (AccountConfiguration) PasswordSHA224

func (ac AccountConfiguration) PasswordSHA224() string

PasswordSHA224() calculates the SHA224 hash of the password, which is used by trojan

func (AccountConfiguration) QuotaBytes

func (ac AccountConfiguration) QuotaBytes() int64

Quota() converts the quota from GB to bytes.

type Credentials

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

func (*Credentials) Admin

func (c *Credentials) Admin() (credentials []*server.Credential)

func (*Credentials) Customer

func (c *Credentials) Customer() (credentials []*server.Credential)

type MysqlConfig

type MysqlConfig struct {
	Host     string `json:"host"`
	Port     uint16 `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	Database string `json:"database"`

	CACertPath     string `json:"ca_cert_path"`
	ClientCertPath string `json:"client_cert_path"`
	ClientKeyPath  string `json:"client_key_path"`
}

type ProvisioningServer

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

func (*ProvisioningServer) CreateAccount

func (p *ProvisioningServer) CreateAccount(productSN uint64, accountConfiguration interface{}) error

func (*ProvisioningServer) DeleteAccount

func (p *ProvisioningServer) DeleteAccount(productSN uint64) error

func (*ProvisioningServer) GetAccount

func (p *ProvisioningServer) GetAccount(productSN uint64) (server.Account, error)

func (*ProvisioningServer) RefreshAccount

func (p *ProvisioningServer) RefreshAccount(productSN uint64) error

Currently only clears data usage

func (*ProvisioningServer) SuspendAccount

func (p *ProvisioningServer) SuspendAccount(productSN uint64) error

Update password_sha224 to some random stuff

func (*ProvisioningServer) UnsuspendAccount

func (p *ProvisioningServer) UnsuspendAccount(productSN uint64) error

Recover password_sha224 from password_encrypted

func (*ProvisioningServer) UpdateAccount

func (p *ProvisioningServer) UpdateAccount(productSN uint64, accountConfiguration interface{}) error

type ProvisioningServerConfig

type ProvisioningServerConfig struct {
	Mysql MysqlConfig `json:"mysql"`
	Info  ServerInfo  `json:"server_info"`
}

func ParseProvisioningServerConfig

func ParseProvisioningServerConfig(v interface{}) (ProvisioningServerConfig, error)

func (ProvisioningServerConfig) ToJson

func (psc ProvisioningServerConfig) ToJson() string

type ServerInfo

type ServerInfo struct {
	ServerAddress          string  `json:"server_address"`
	ServerPort             uint16  `json:"server_port"`
	ServerMonthlyBandwidth float64 `json:"server_monthly_bandwidth"` // in bytes
}

Jump to

Keyboard shortcuts

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