Documentation
¶
Index ¶
- Constants
- func AddInboundUser(ctx context.Context, c proxy.HandlerServiceClient, tag string, user *User) error
- func RemoveInboundUser(ctx context.Context, c proxy.HandlerServiceClient, tag string, user *User) error
- func StartSyncTask(ctx context.Context, cfg *config.Config) error
- func StartXrayServer(ctx context.Context, cfg *config.Config) (*core.Instance, error)
- type SyncTrafficReq
- type SyncUserConfigsResp
- type User
- type UserPool
- func (up *UserPool) CreateUser(userId, level int, password, method, protocol string, enable bool) *User
- func (up *UserPool) GetAllUsers() []*User
- func (up *UserPool) GetUser(id int) (*User, bool)
- func (up *UserPool) RemoveUser(id int)
- func (up *UserPool) StartSyncUserTask(ctx context.Context, endpoint, tag string)
- type UserTraffic
Constants ¶
View Source
const ( XrayAPITag = "api" XraySSProxyTag = "ss_proxy" XrayTrojanProxyTag = "trojan_proxy" SyncTime = 60 )
Variables ¶
This section is empty.
Functions ¶
func AddInboundUser ¶
func AddInboundUser(ctx context.Context, c proxy.HandlerServiceClient, tag string, user *User) error
AddInboundUser add user to inbound by tag
func RemoveInboundUser ¶
func RemoveInboundUser(ctx context.Context, c proxy.HandlerServiceClient, tag string, user *User) error
RemoveInboundUser remove user from inbound by tag
Types ¶
type SyncTrafficReq ¶
type SyncTrafficReq struct {
Data []*UserTraffic `json:"data"`
}
type SyncUserConfigsResp ¶
type SyncUserConfigsResp struct {
Users []*User `json:"users"`
}
type User ¶
type User struct { ID int `json:"user_id"` Method string `json:"method"` Password string `json:"password"` Level int `json:"level"` Enable bool `json:"enable"` UploadTraffic int64 `json:"upload_traffic"` DownloadTraffic int64 `json:"download_traffic"` Protocol string `json:"protocol"` // contains filtered or unexported fields }
func (*User) GenTraffic ¶
func (u *User) GenTraffic() *UserTraffic
func (*User) ResetTraffic ¶
func (u *User) ResetTraffic()
func (*User) ToXrayUser ¶
func (*User) UpdateFromServer ¶
type UserPool ¶
UserPool user pool
func NewUserPool ¶
NewUserPool New UserPool
func (*UserPool) CreateUser ¶
func (*UserPool) GetAllUsers ¶
func (*UserPool) RemoveUser ¶
Click to show internal directories.
Click to hide internal directories.