Documentation ¶
Index ¶
- Constants
- func ParseTLSVersion(version string) (uint16, error)
- type Application
- type ApplicationPublicOptions
- type EnvoyEmail
- type EnvoyGotify
- type EnvoyHeader
- type EnvoyLog
- type EnvoyNtfy
- type EnvoyPolicy
- type EnvoyPolicyType
- type EnvoyTelegram
- type EnvoyWebhook
- type OfflineLog
- type SentryLog
- type TLS
- type Timezone
- type User
- func (this *User) CheckPassword(pwd string) bool
- func (this *User) SetPassword(ctx context.Context, pwd string) error
- func (this *User) SetUserLevel(ctx context.Context, level UserLevel, ttl ...time.Duration) error
- func (this *User) UsageEntityAccessible() bool
- func (this *User) UsageEntityIncr(ctx context.Context, delta int32) error
- func (this *User) UsageEnvoyAccessible() bool
- func (this *User) UsageEnvoyIncr(ctx context.Context, delta int32) error
- func (this *User) UsageEnvoyPolicyAccessible() bool
- func (this *User) UsageEnvoyPolicyIncr(ctx context.Context, delta int32) error
- func (this *User) UsageEnvoySMSAccessible() bool
- func (this *User) UsageEnvoySMSIncr(ctx context.Context, delta int32) error
- type UserGetter
- type UserLevel
- type UserLoginLog
- type UserUsage
Constants ¶
View Source
const DefaultTimezone = "Asia/Shanghai"
View Source
const SALT = "MONGOUSERSALT"
View Source
const TLSMinVersionDefault = tls.VersionTLS12
Variables ¶
This section is empty.
Functions ¶
func ParseTLSVersion ¶
ParseTLSVersion returns a `uint16` by received version string key that represents tls version from crypto/tls. If version isn't supported ParseTLSVersion returns 0 with error
Types ¶
type Application ¶
type Application struct { ID primitive.ObjectID `json:"ID" bson:"_id"` Name string `json:"Name" bson:"Name"` Description string `json:"Description" bson:"Description"` UserID primitive.ObjectID `json:"UserID" bson:"UserID"` CreatedAt time.Time `json:"CreatedAt" bson:"CreatedAt"` Scheme string `json:"Scheme" bson:"Scheme"` Active bool `json:"Active" bson:"Active"` Public ApplicationPublicOptions `json:"Public" bson:"Public"` Options bson.M `json:"Options" bson:"Options"` }
func (*Application) User ¶
func (this *Application) User() (*User, error)
type EnvoyEmail ¶
type EnvoyEmail struct { EnvoyHeader `json:"EnvoyHeader" bson:"EnvoyHeader"` ID primitive.ObjectID `json:"ID" bson:"_id"` Address string `json:"Address" bson:"Address"` }
type EnvoyGotify ¶
type EnvoyGotify struct { EnvoyHeader `json:"EnvoyHeader" bson:"EnvoyHeader"` ID primitive.ObjectID `json:"ID" bson:"_id"` URL string `json:"URL" bson:"URL"` Token string `json:"Token" bson:"Token"` }
type EnvoyHeader ¶
type EnvoyLog ¶
type EnvoyLog struct { ID primitive.ObjectID `json:"ID" bson:"_id"` SendTime time.Time `json:"SendTime" bson:"SendTime"` Success bool `json:"Success" bson:"Success"` FailedMessage string `json:"FailedMessage" bson:"FailedMessage"` OfflineLogID primitive.ObjectID `json:"OfflineLogID" bson:"OfflineLogID"` PolicyType string `json:"PolicyType" bson:"PolicyType"` PolicySnapShot bson.M `json:"PolicySnapShot" bson:"PolicySnapShot"` }
type EnvoyNtfy ¶
type EnvoyNtfy struct { EnvoyHeader `json:"EnvoyHeader" bson:"EnvoyHeader"` ID primitive.ObjectID `json:"ID" bson:"_id"` }
type EnvoyPolicy ¶
type EnvoyPolicy struct { PolicyID primitive.ObjectID `json:"PolicyID" bson:"PolicyID"` PolicyType EnvoyPolicyType `json:"PolicyType" bson:"PolicyType"` }
type EnvoyPolicyType ¶
type EnvoyPolicyType int
const ( IsEnvoyEmail EnvoyPolicyType = iota + 1000 IsEnvoyGotify IsEnvoySMS IsEnvoyTelegram IsEnvoyWebhook )
func (EnvoyPolicyType) GetCollection ¶
func (this EnvoyPolicyType) GetCollection() *mongo.Collection
type EnvoyTelegram ¶
type EnvoyTelegram struct { EnvoyHeader `json:"EnvoyHeader" bson:"EnvoyHeader"` ID primitive.ObjectID `json:"ID" bson:"_id"` ChatID int64 `json:"ChatID" bson:"ChatID"` }
type EnvoyWebhook ¶
type EnvoyWebhook struct { EnvoyHeader `json:"EnvoyHeader" bson:"EnvoyHeader"` ID primitive.ObjectID `json:"ID" bson:"_id"` URL string `json:"URL" bson:"URL"` Insecure bool `json:"Insecure" bson:"Insecure"` // true: HTTP, false: HTTPS AuthMethod string `json:"AuthMethod" bson:"AuthMethod"` // "None" "Basic" "Bearer" BasicUsername string `json:"BasicUsername" bson:"BasicUsername"` BasicPassword string `json:"BasicPassword" bson:"BasicPassword"` BearerToken string `json:"BearerToken" bson:"BearerToken"` }
type OfflineLog ¶
type TLS ¶
type TLS struct { ID primitive.ObjectID `json:"ID" bson:"_id"` UserID primitive.ObjectID `json:"UserID" bson:"UserID"` Name string `json:"Name" bson:"Name"` // TLS Settings TLSCA string `json:"TLSCA" bson:"TLSCA"` TLSCert string `json:"TLSCert" bson:"TLSCert"` TLSKey string `json:"TLSKey" bson:"TLSKey"` TLSKeyPwd string `json:"TLSKeyPwd" bson:"TLSKeyPwd"` TLSMinVersion string `json:"TLSMinVersion" bson:"TLSMinVersion"` // "TLS10" "TLS11" "TLS12" "TLS13" Insecure bool `json:"Insecure" bson:"Insecure"` }
type User ¶
type User struct { ID primitive.ObjectID `json:"ID" bson:"_id"` Email string `json:"Email" bson:"Email"` Password string `json:"Password" bson:"Password"` CreatedAt time.Time `json:"CreatedAt" bson:"CreatedAt"` Level UserLevel `json:"Level" bson:"Level"` // default(free) level: 0 LevelExpireAt time.Time `json:"LevelExpireAt" bson:"LevelExpireAt"` Usage UserUsage `json:"Usage" bson:"Usage"` EnvoyPolicies []EnvoyPolicy `json:"EnvoyPolicies" bson:"EnvoyPolicies"` Timezone Timezone `json:"Timezone" bson:"Timezone"` CustomSentries []string `json:"CustomSentries" bson:"CustomSentries"` }
func (*User) CheckPassword ¶
func (*User) SetUserLevel ¶
func (*User) UsageEntityAccessible ¶
func (*User) UsageEntityIncr ¶
func (*User) UsageEnvoyAccessible ¶
func (*User) UsageEnvoyIncr ¶
func (*User) UsageEnvoyPolicyAccessible ¶
func (*User) UsageEnvoyPolicyIncr ¶
func (*User) UsageEnvoySMSAccessible ¶
type UserGetter ¶
type UserLoginLog ¶
type UserLoginLog struct { ID primitive.ObjectID `json:"ID" bson:"_id"` UserID primitive.ObjectID `json:"UserID" bson:"UserID"` LoginTime time.Time `json:"LoginTime" bson:"LoginTime"` Location string `json:"Location" bson:"Location"` Device string `json:"Device" bson:"Device"` DeviceType string `json:"DeviceType" bson:"DeviceType"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.