Documentation
¶
Index ¶
- Constants
- Variables
- func AttachConnectionSourceFromCandidates(item *ConnectionEntry, candidates []ConnectionEntry)
- func AttachConnectionSources(items []ConnectionEntry)
- func EnrichConnectionEntriesOwners(entries []*ConnectionEntry, limit int)
- func EnrichConnectionEntryOwners(entry *ConnectionEntry)
- func EnrichConnectionEntryOwnersWithBudget(entry *ConnectionEntry, budget *ConnectionOwnerLookupBudget)
- func GenerateWireGuardPresharedKey() (string, error)
- func ValidateTokenOptions(expiryDays int64, description string) error
- type AuthService
- func (s *AuthService) BeginOIDC(ctx context.Context) (*OIDCStart, error)
- func (s *AuthService) BeginPasskeyLogin(username string, request *http.Request) (interface{}, string, error)
- func (s *AuthService) BeginPasskeyRegistration(username string, request *http.Request) (interface{}, string, error)
- func (s *AuthService) DeletePasskey(username, id string) error
- func (s *AuthService) FinishOIDC(ctx context.Context, state, code string) (string, error)
- func (s *AuthService) FinishPasskeyLogin(sessionID string, request *http.Request) (string, error)
- func (s *AuthService) FinishPasskeyRegistration(username, sessionID, requestedName string, request *http.Request) (string, error)
- func (s *AuthService) ListPasskeys(username string) ([]model.PasskeyCredential, error)
- func (s *AuthService) PublicAuthMethods() map[string]interface{}
- func (s *AuthService) RenamePasskey(username, id, name string) error
- func (s *AuthService) SecuritySummary(username string) (map[string]interface{}, error)
- type ChangesFilter
- type ChangesQueryResult
- type ClientService
- func (s *ClientService) DepleteClients() (inboundIds []uint, err error)
- func (s *ClientService) EnsureClientSubIds(db *gorm.DB) error
- func (s *ClientService) Get(id string) (*[]model.Client, error)
- func (s *ClientService) GetAll() (*[]model.Client, error)
- func (s *ClientService) GetEnabledBySubscriptionKey(db *gorm.DB, key string) (*model.Client, error)
- func (s *ClientService) ResetClients(tx *gorm.DB, dt int64) ([]uint, bool, error)
- func (s *ClientService) Save(tx *gorm.DB, act string, data json.RawMessage, hostname string) ([]uint, error)
- func (s *ClientService) UpdateClientsOnInboundAdd(tx *gorm.DB, initIds string, inboundId uint, hostname string) error
- func (s *ClientService) UpdateClientsOnInboundDelete(tx *gorm.DB, id uint, tag string) error
- func (s *ClientService) UpdateLinksByInboundChange(tx *gorm.DB, inbounds *[]model.Inbound, hostname string, oldTag string) error
- type ConfigService
- func (s *ConfigService) CheckChanges(lu string) (bool, error)
- func (s *ConfigService) CheckOutbound(tag string, link string) core.CheckOutboundResult
- func (s *ConfigService) GetChanges(actor string, chngKey string, count string) []model.Changes
- func (s *ConfigService) GetConfig(data string) (*[]byte, error)
- func (s *ConfigService) QueryChanges(filter ChangesFilter) (*ChangesQueryResult, error)
- func (s *ConfigService) RestartCore() error
- func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initUsers string, ...) ([]string, error)
- func (s *ConfigService) SaveWithApply(obj string, act string, data json.RawMessage, initUsers string, ...) (objs []string, err error)
- func (s *ConfigService) StartCore() error
- func (s *ConfigService) StopCore() error
- type ConnectionEntry
- type ConnectionFilter
- type ConnectionIPInfo
- type ConnectionOwnerLookupBudget
- type ConnectionQueryResult
- type ConnectionSummary
- type EndpointService
- func (s *EndpointService) ExportWireGuardPeer(tag string, peerIndex int) (*WireGuardExport, error)
- func (o *EndpointService) GetAll() (*[]map[string]interface{}, error)
- func (o *EndpointService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (s *EndpointService) Save(tx *gorm.DB, act string, data json.RawMessage) error
- type InboundService
- func (s *InboundService) FromIds(ids []uint) ([]*model.Inbound, error)
- func (s *InboundService) Get(ids string) (*[]map[string]interface{}, error)
- func (s *InboundService) GetAll() (*[]map[string]interface{}, error)
- func (s *InboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (s *InboundService) RestartInbounds(tx *gorm.DB, ids []uint) error
- func (s *InboundService) Save(tx *gorm.DB, act string, data json.RawMessage, initUserIds string, ...) error
- func (s *InboundService) UpdateOutJsons(tx *gorm.DB, inboundIds []uint, hostname string) error
- type OIDCStart
- type OutboundService
- type PanelService
- type ServerService
- func (s *ServerService) GenKeypair(keyType string, options string) []string
- func (s *ServerService) GetCpuPercent() float64
- func (s *ServerService) GetDatabaseInfo() map[string]int64
- func (s *ServerService) GetDiskIO() map[string]interface{}
- func (s *ServerService) GetDiskInfo() map[string]interface{}
- func (s *ServerService) GetLogs(count string, level string) []string
- func (s *ServerService) GetMemInfo() map[string]interface{}
- func (s *ServerService) GetNetInfo() map[string]interface{}
- func (s *ServerService) GetSingboxInfo() map[string]interface{}
- func (s *ServerService) GetStatus(request string) *map[string]interface{}
- func (s *ServerService) GetSwapInfo() map[string]interface{}
- func (s *ServerService) GetSystemInfo() map[string]interface{}
- type ServicesService
- func (s *ServicesService) GetAll() (*[]map[string]interface{}, error)
- func (s *ServicesService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
- func (s *ServicesService) RestartServices(tx *gorm.DB, ids []uint) error
- func (s *ServicesService) Save(tx *gorm.DB, act string, data json.RawMessage) error
- type SettingService
- func (s *SettingService) GetAllSetting() (*map[string]string, error)
- func (s *SettingService) GetAuthSetting(key string) (string, error)
- func (s *SettingService) GetCertFile() (string, error)
- func (s *SettingService) GetConfig() (string, error)
- func (s *SettingService) GetFinalSubURI(host string) (string, error)
- func (s *SettingService) GetKeyFile() (string, error)
- func (s *SettingService) GetListen() (string, error)
- func (s *SettingService) GetOIDCEnabled() (bool, error)
- func (s *SettingService) GetPasskeyEnabled() (bool, error)
- func (s *SettingService) GetPort() (int, error)
- func (s *SettingService) GetSecret() ([]byte, error)
- func (s *SettingService) GetSessionMaxAge() (int, error)
- func (s *SettingService) GetSubCertFile() (string, error)
- func (s *SettingService) GetSubClashExt() (string, error)
- func (s *SettingService) GetSubDomain() (string, error)
- func (s *SettingService) GetSubEncode() (bool, error)
- func (s *SettingService) GetSubInfoOptions() SubInfoOptions
- func (s *SettingService) GetSubJsonExt() (string, error)
- func (s *SettingService) GetSubKeyFile() (string, error)
- func (s *SettingService) GetSubListen() (string, error)
- func (s *SettingService) GetSubPath() (string, error)
- func (s *SettingService) GetSubPort() (int, error)
- func (s *SettingService) GetSubShowInfo() (bool, error)
- func (s *SettingService) GetSubURI() (string, error)
- func (s *SettingService) GetSubUpdates() (int, error)
- func (s *SettingService) GetTimeLocation() (*time.Location, error)
- func (s *SettingService) GetTrafficAge() (int, error)
- func (s *SettingService) GetWebDomain() (string, error)
- func (s *SettingService) GetWebPath() (string, error)
- func (s *SettingService) ResetSettings() error
- func (s *SettingService) Save(tx *gorm.DB, data json.RawMessage) error
- func (s *SettingService) SaveConfig(tx *gorm.DB, config json.RawMessage) error
- func (s *SettingService) SetConfig(config string) error
- func (s *SettingService) SetPort(port int) error
- func (s *SettingService) SetSubPath(subPath string) error
- func (s *SettingService) SetSubPort(subPort int) error
- func (s *SettingService) SetWebPath(webPath string) error
- type SingBoxConfig
- type StatsFilter
- type StatsQueryResult
- type StatsService
- func (s *StatsService) DelOldStats(days int) error
- func (s *StatsService) GetOnlines() (onlines, error)
- func (s *StatsService) GetStats(resource string, tag string, limit int) ([]model.Stats, error)
- func (s *StatsService) QueryConnections(filter ConnectionFilter) (*ConnectionQueryResult, error)
- func (s *StatsService) QueryStats(filter StatsFilter) (*StatsQueryResult, error)
- func (s *StatsService) QueryUsage(filter UsageFilter) (*UsageQueryResult, error)
- func (s *StatsService) SaveStats(enableTraffic bool) error
- type SubInfoOptions
- type TlsService
- type UsageFilter
- type UsageQueryResult
- type UserService
- func (s *UserService) AddToken(username string, expiry int64, desc string) (string, error)
- func (s *UserService) BeginTOTP(username, issuer string) (map[string]string, error)
- func (s *UserService) ChangePass(id string, oldPass string, newUser string, newPass string) error
- func (s *UserService) CheckPassword(username string, password string, remoteIP string) (*model.User, error)
- func (s *UserService) CheckUser(username string, password string, remoteIP string) *model.User
- func (s *UserService) DeleteToken(id string) error
- func (s *UserService) DeleteTokenValue(username string, token string) error
- func (s *UserService) DeleteUserToken(username string, id string) error
- func (s *UserService) DisableTOTP(username, password, code, remoteIP string) error
- func (s *UserService) EnableTOTP(username, code string) ([]string, error)
- func (s *UserService) GetFirstUser() (*model.User, error)
- func (s *UserService) GetUserTokens(username string) (*[]model.Tokens, error)
- func (s *UserService) GetUsers() (*[]model.User, error)
- func (s *UserService) LoadTokens() ([]byte, error)
- func (s *UserService) Login(username string, password string, remoteIP string) (string, error)
- func (s *UserService) RecordLogin(username, remoteIP string)
- func (s *UserService) UpdateFirstUser(username string, password string) error
- func (s *UserService) VerifySecondFactor(user *model.User, code string) bool
- type UserUsage
- type WarpService
- type WireGuardExport
Constants ¶
View Source
const ( MaxTokenExpiryDays int64 = 3650 MaxTokenDescriptionRunes = 128 )
Variables ¶
View Source
var (
LastUpdate atomic.Int64
)
Functions ¶
func AttachConnectionSourceFromCandidates ¶
func AttachConnectionSourceFromCandidates(item *ConnectionEntry, candidates []ConnectionEntry)
func AttachConnectionSources ¶
func AttachConnectionSources(items []ConnectionEntry)
func EnrichConnectionEntriesOwners ¶ added in v1.0.13
func EnrichConnectionEntriesOwners(entries []*ConnectionEntry, limit int)
EnrichConnectionEntriesOwners resolves and describes only the requested page. Lookups are deduplicated and share one deadline so log APIs remain responsive.
func EnrichConnectionEntryOwners ¶
func EnrichConnectionEntryOwners(entry *ConnectionEntry)
func EnrichConnectionEntryOwnersWithBudget ¶
func EnrichConnectionEntryOwnersWithBudget(entry *ConnectionEntry, budget *ConnectionOwnerLookupBudget)
func ValidateTokenOptions ¶ added in v1.0.12
Types ¶
type AuthService ¶
type AuthService struct {
SettingService
UserService
}
func (*AuthService) BeginOIDC ¶
func (s *AuthService) BeginOIDC(ctx context.Context) (*OIDCStart, error)
func (*AuthService) BeginPasskeyLogin ¶
func (*AuthService) BeginPasskeyRegistration ¶
func (*AuthService) DeletePasskey ¶
func (s *AuthService) DeletePasskey(username, id string) error
func (*AuthService) FinishOIDC ¶
func (*AuthService) FinishPasskeyLogin ¶
func (*AuthService) FinishPasskeyRegistration ¶
func (*AuthService) ListPasskeys ¶
func (s *AuthService) ListPasskeys(username string) ([]model.PasskeyCredential, error)
func (*AuthService) PublicAuthMethods ¶
func (s *AuthService) PublicAuthMethods() map[string]interface{}
func (*AuthService) RenamePasskey ¶
func (s *AuthService) RenamePasskey(username, id, name string) error
func (*AuthService) SecuritySummary ¶
func (s *AuthService) SecuritySummary(username string) (map[string]interface{}, error)
type ChangesFilter ¶
type ChangesQueryResult ¶
type ClientService ¶
type ClientService struct{}
func (*ClientService) DepleteClients ¶
func (s *ClientService) DepleteClients() (inboundIds []uint, err error)
func (*ClientService) EnsureClientSubIds ¶
func (s *ClientService) EnsureClientSubIds(db *gorm.DB) error
func (*ClientService) GetEnabledBySubscriptionKey ¶ added in v1.0.9
func (*ClientService) ResetClients ¶
func (*ClientService) Save ¶
func (s *ClientService) Save(tx *gorm.DB, act string, data json.RawMessage, hostname string) ([]uint, error)
func (*ClientService) UpdateClientsOnInboundAdd ¶
func (*ClientService) UpdateClientsOnInboundDelete ¶
func (*ClientService) UpdateLinksByInboundChange ¶
type ConfigService ¶
type ConfigService struct {
ClientService
TlsService
SettingService
InboundService
OutboundService
ServicesService
EndpointService
}
func NewConfigService ¶
func NewConfigService(core *core.Core) *ConfigService
func (*ConfigService) CheckChanges ¶
func (s *ConfigService) CheckChanges(lu string) (bool, error)
func (*ConfigService) CheckOutbound ¶
func (s *ConfigService) CheckOutbound(tag string, link string) core.CheckOutboundResult
func (*ConfigService) GetChanges ¶
func (*ConfigService) QueryChanges ¶
func (s *ConfigService) QueryChanges(filter ChangesFilter) (*ChangesQueryResult, error)
func (*ConfigService) RestartCore ¶
func (s *ConfigService) RestartCore() error
func (*ConfigService) Save ¶
func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initUsers string, loginUser string, hostname string) ([]string, error)
func (*ConfigService) SaveWithApply ¶
func (*ConfigService) StartCore ¶
func (s *ConfigService) StartCore() error
func (*ConfigService) StopCore ¶
func (s *ConfigService) StopCore() error
type ConnectionEntry ¶
type ConnectionEntry struct {
Timestamp int64 `json:"timestamp"`
Time string `json:"time"`
Resource string `json:"resource"`
Protocol string `json:"protocol"`
Tag string `json:"tag"`
User string `json:"user,omitempty"`
Event string `json:"event"`
Remote string `json:"remote,omitempty"`
RemoteInfo *ConnectionIPInfo `json:"remoteInfo,omitempty"`
Destination string `json:"destination,omitempty"`
DestinationInfo *ConnectionIPInfo `json:"destinationInfo,omitempty"`
Source string `json:"source,omitempty"`
SourceInfo *ConnectionIPInfo `json:"sourceInfo,omitempty"`
Message string `json:"message"`
}
func ParseConnectionLog ¶
func ParseConnectionLog(entry logger.LogEntry) (ConnectionEntry, bool)
type ConnectionFilter ¶
type ConnectionIPInfo ¶
type ConnectionIPInfo struct {
Address string `json:"address,omitempty"`
Host string `json:"host,omitempty"`
Port string `json:"port,omitempty"`
IP string `json:"ip,omitempty"`
Scope string `json:"scope,omitempty"`
Attribution string `json:"attribution,omitempty"`
ISP string `json:"isp,omitempty"`
ASN string `json:"asn,omitempty"`
Country string `json:"country,omitempty"`
Region string `json:"region,omitempty"`
City string `json:"city,omitempty"`
Network string `json:"network,omitempty"`
}
func ResolveConnectionAddress ¶ added in v1.0.13
func ResolveConnectionAddress(ctx context.Context, value string) (*ConnectionIPInfo, error)
type ConnectionOwnerLookupBudget ¶
type ConnectionOwnerLookupBudget struct {
// contains filtered or unexported fields
}
func NewConnectionOwnerLookupBudget ¶
func NewConnectionOwnerLookupBudget(limit int) *ConnectionOwnerLookupBudget
type ConnectionQueryResult ¶
type ConnectionQueryResult struct {
Items []ConnectionEntry `json:"items"`
Total int `json:"total"`
Offset int `json:"offset"`
Limit int `json:"limit"`
Summary map[string][]ConnectionSummary `json:"summary"`
Parsed int `json:"parsed"`
Scanned int `json:"scanned"`
}
type ConnectionSummary ¶
type EndpointService ¶
type EndpointService struct {
WarpService
}
func (*EndpointService) ExportWireGuardPeer ¶
func (s *EndpointService) ExportWireGuardPeer(tag string, peerIndex int) (*WireGuardExport, error)
func (*EndpointService) GetAll ¶
func (o *EndpointService) GetAll() (*[]map[string]interface{}, error)
func (*EndpointService) GetAllConfig ¶
func (o *EndpointService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*EndpointService) Save ¶
func (s *EndpointService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type InboundService ¶
type InboundService struct {
ClientService
}
func (*InboundService) FromIds ¶
func (s *InboundService) FromIds(ids []uint) ([]*model.Inbound, error)
func (*InboundService) Get ¶
func (s *InboundService) Get(ids string) (*[]map[string]interface{}, error)
func (*InboundService) GetAll ¶
func (s *InboundService) GetAll() (*[]map[string]interface{}, error)
func (*InboundService) GetAllConfig ¶
func (s *InboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*InboundService) RestartInbounds ¶
func (s *InboundService) RestartInbounds(tx *gorm.DB, ids []uint) error
func (*InboundService) Save ¶
func (s *InboundService) Save(tx *gorm.DB, act string, data json.RawMessage, initUserIds string, hostname string) error
func (*InboundService) UpdateOutJsons ¶
type OutboundService ¶
type OutboundService struct{}
func (*OutboundService) GetAll ¶
func (o *OutboundService) GetAll() (*[]map[string]interface{}, error)
func (*OutboundService) GetAllConfig ¶
func (o *OutboundService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*OutboundService) Save ¶
func (s *OutboundService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type PanelService ¶
type PanelService struct {
}
func (*PanelService) RestartPanel ¶
func (s *PanelService) RestartPanel(delay time.Duration) error
type ServerService ¶
type ServerService struct{}
func (*ServerService) GenKeypair ¶
func (s *ServerService) GenKeypair(keyType string, options string) []string
func (*ServerService) GetCpuPercent ¶
func (s *ServerService) GetCpuPercent() float64
func (*ServerService) GetDatabaseInfo ¶
func (s *ServerService) GetDatabaseInfo() map[string]int64
func (*ServerService) GetDiskIO ¶
func (s *ServerService) GetDiskIO() map[string]interface{}
func (*ServerService) GetDiskInfo ¶
func (s *ServerService) GetDiskInfo() map[string]interface{}
func (*ServerService) GetLogs ¶
func (s *ServerService) GetLogs(count string, level string) []string
func (*ServerService) GetMemInfo ¶
func (s *ServerService) GetMemInfo() map[string]interface{}
func (*ServerService) GetNetInfo ¶
func (s *ServerService) GetNetInfo() map[string]interface{}
func (*ServerService) GetSingboxInfo ¶
func (s *ServerService) GetSingboxInfo() map[string]interface{}
func (*ServerService) GetStatus ¶
func (s *ServerService) GetStatus(request string) *map[string]interface{}
func (*ServerService) GetSwapInfo ¶
func (s *ServerService) GetSwapInfo() map[string]interface{}
func (*ServerService) GetSystemInfo ¶
func (s *ServerService) GetSystemInfo() map[string]interface{}
type ServicesService ¶
type ServicesService struct{}
func (*ServicesService) GetAll ¶
func (s *ServicesService) GetAll() (*[]map[string]interface{}, error)
func (*ServicesService) GetAllConfig ¶
func (s *ServicesService) GetAllConfig(db *gorm.DB) ([]json.RawMessage, error)
func (*ServicesService) RestartServices ¶
func (s *ServicesService) RestartServices(tx *gorm.DB, ids []uint) error
func (*ServicesService) Save ¶
func (s *ServicesService) Save(tx *gorm.DB, act string, data json.RawMessage) error
type SettingService ¶
type SettingService struct{}
func (*SettingService) GetAllSetting ¶
func (s *SettingService) GetAllSetting() (*map[string]string, error)
func (*SettingService) GetAuthSetting ¶
func (s *SettingService) GetAuthSetting(key string) (string, error)
func (*SettingService) GetCertFile ¶
func (s *SettingService) GetCertFile() (string, error)
func (*SettingService) GetConfig ¶
func (s *SettingService) GetConfig() (string, error)
func (*SettingService) GetFinalSubURI ¶
func (s *SettingService) GetFinalSubURI(host string) (string, error)
func (*SettingService) GetKeyFile ¶
func (s *SettingService) GetKeyFile() (string, error)
func (*SettingService) GetListen ¶
func (s *SettingService) GetListen() (string, error)
func (*SettingService) GetOIDCEnabled ¶
func (s *SettingService) GetOIDCEnabled() (bool, error)
func (*SettingService) GetPasskeyEnabled ¶
func (s *SettingService) GetPasskeyEnabled() (bool, error)
func (*SettingService) GetPort ¶
func (s *SettingService) GetPort() (int, error)
func (*SettingService) GetSecret ¶
func (s *SettingService) GetSecret() ([]byte, error)
func (*SettingService) GetSessionMaxAge ¶
func (s *SettingService) GetSessionMaxAge() (int, error)
func (*SettingService) GetSubCertFile ¶
func (s *SettingService) GetSubCertFile() (string, error)
func (*SettingService) GetSubClashExt ¶
func (s *SettingService) GetSubClashExt() (string, error)
func (*SettingService) GetSubDomain ¶
func (s *SettingService) GetSubDomain() (string, error)
func (*SettingService) GetSubEncode ¶
func (s *SettingService) GetSubEncode() (bool, error)
func (*SettingService) GetSubInfoOptions ¶
func (s *SettingService) GetSubInfoOptions() SubInfoOptions
func (*SettingService) GetSubJsonExt ¶
func (s *SettingService) GetSubJsonExt() (string, error)
func (*SettingService) GetSubKeyFile ¶
func (s *SettingService) GetSubKeyFile() (string, error)
func (*SettingService) GetSubListen ¶
func (s *SettingService) GetSubListen() (string, error)
func (*SettingService) GetSubPath ¶
func (s *SettingService) GetSubPath() (string, error)
func (*SettingService) GetSubPort ¶
func (s *SettingService) GetSubPort() (int, error)
func (*SettingService) GetSubShowInfo ¶
func (s *SettingService) GetSubShowInfo() (bool, error)
func (*SettingService) GetSubURI ¶
func (s *SettingService) GetSubURI() (string, error)
func (*SettingService) GetSubUpdates ¶
func (s *SettingService) GetSubUpdates() (int, error)
func (*SettingService) GetTimeLocation ¶
func (s *SettingService) GetTimeLocation() (*time.Location, error)
func (*SettingService) GetTrafficAge ¶
func (s *SettingService) GetTrafficAge() (int, error)
func (*SettingService) GetWebDomain ¶
func (s *SettingService) GetWebDomain() (string, error)
func (*SettingService) GetWebPath ¶
func (s *SettingService) GetWebPath() (string, error)
func (*SettingService) ResetSettings ¶
func (s *SettingService) ResetSettings() error
func (*SettingService) Save ¶
func (s *SettingService) Save(tx *gorm.DB, data json.RawMessage) error
func (*SettingService) SaveConfig ¶
func (s *SettingService) SaveConfig(tx *gorm.DB, config json.RawMessage) error
func (*SettingService) SetConfig ¶
func (s *SettingService) SetConfig(config string) error
func (*SettingService) SetPort ¶
func (s *SettingService) SetPort(port int) error
func (*SettingService) SetSubPath ¶
func (s *SettingService) SetSubPath(subPath string) error
func (*SettingService) SetSubPort ¶
func (s *SettingService) SetSubPort(subPort int) error
func (*SettingService) SetWebPath ¶
func (s *SettingService) SetWebPath(webPath string) error
type SingBoxConfig ¶
type SingBoxConfig struct {
Log json.RawMessage `json:"log"`
Dns json.RawMessage `json:"dns"`
Ntp json.RawMessage `json:"ntp"`
Inbounds []json.RawMessage `json:"inbounds"`
Outbounds []json.RawMessage `json:"outbounds"`
Services []json.RawMessage `json:"services"`
Endpoints []json.RawMessage `json:"endpoints"`
Route json.RawMessage `json:"route"`
Experimental json.RawMessage `json:"experimental"`
}
type StatsFilter ¶
type StatsFilter struct {
Resource string
Tag string
Search string
Start int64
End int64
Offset int
Limit int
}
StatsFilter is shared by the app API's chart and drill-down endpoints. Start and End are Unix seconds. A zero value leaves that boundary open.
type StatsQueryResult ¶
type StatsService ¶
type StatsService struct {
}
func (*StatsService) DelOldStats ¶
func (s *StatsService) DelOldStats(days int) error
func (*StatsService) GetOnlines ¶
func (s *StatsService) GetOnlines() (onlines, error)
func (*StatsService) QueryConnections ¶
func (s *StatsService) QueryConnections(filter ConnectionFilter) (*ConnectionQueryResult, error)
func (*StatsService) QueryStats ¶
func (s *StatsService) QueryStats(filter StatsFilter) (*StatsQueryResult, error)
func (*StatsService) QueryUsage ¶
func (s *StatsService) QueryUsage(filter UsageFilter) (*UsageQueryResult, error)
func (*StatsService) SaveStats ¶
func (s *StatsService) SaveStats(enableTraffic bool) error
type SubInfoOptions ¶
type TlsService ¶
type TlsService struct {
InboundService
ServicesService
}
func (*TlsService) Save ¶
func (s *TlsService) Save(tx *gorm.DB, action string, data json.RawMessage, hostname string) error
type UsageFilter ¶
type UsageQueryResult ¶
type UserService ¶
type UserService struct{}
func (*UserService) BeginTOTP ¶
func (s *UserService) BeginTOTP(username, issuer string) (map[string]string, error)
func (*UserService) ChangePass ¶
func (*UserService) CheckPassword ¶
func (*UserService) DeleteToken ¶
func (s *UserService) DeleteToken(id string) error
func (*UserService) DeleteTokenValue ¶
func (s *UserService) DeleteTokenValue(username string, token string) error
func (*UserService) DeleteUserToken ¶
func (s *UserService) DeleteUserToken(username string, id string) error
DeleteUserToken prevents one administrator token from deleting another administrator's token by guessing its numeric id.
func (*UserService) DisableTOTP ¶
func (s *UserService) DisableTOTP(username, password, code, remoteIP string) error
func (*UserService) EnableTOTP ¶
func (s *UserService) EnableTOTP(username, code string) ([]string, error)
func (*UserService) GetFirstUser ¶
func (s *UserService) GetFirstUser() (*model.User, error)
func (*UserService) GetUserTokens ¶
func (s *UserService) GetUserTokens(username string) (*[]model.Tokens, error)
func (*UserService) LoadTokens ¶
func (s *UserService) LoadTokens() ([]byte, error)
func (*UserService) RecordLogin ¶
func (s *UserService) RecordLogin(username, remoteIP string)
func (*UserService) UpdateFirstUser ¶
func (s *UserService) UpdateFirstUser(username string, password string) error
func (*UserService) VerifySecondFactor ¶
func (s *UserService) VerifySecondFactor(user *model.User, code string) bool
type UserUsage ¶
type UserUsage struct {
User string `json:"user" gorm:"column:user"`
Upload int64 `json:"upload" gorm:"column:upload"`
Download int64 `json:"download" gorm:"column:download"`
Total int64 `json:"total" gorm:"column:total"`
Enabled bool `json:"enabled" gorm:"-"`
Quota int64 `json:"quota" gorm:"-"`
Expiry int64 `json:"expiry" gorm:"-"`
Group string `json:"group,omitempty" gorm:"-"`
Online bool `json:"online" gorm:"-"`
LifetimeUp int64 `json:"lifetimeUpload" gorm:"-"`
LifetimeDn int64 `json:"lifetimeDownload" gorm:"-"`
}
type WarpService ¶
type WarpService struct{}
func (*WarpService) RegisterWarp ¶
func (s *WarpService) RegisterWarp(endpoint *model.Endpoint) error
func (*WarpService) SetWarpLicense ¶
func (s *WarpService) SetWarpLicense(oldLicense string, endpoint *model.Endpoint) error
type WireGuardExport ¶
Click to show internal directories.
Click to hide internal directories.