Documentation
¶
Index ¶
- Variables
- func ToTypedMessage(account proto.Message) (*serial.TypedMessage, error)
- type Account
- type BaseAccount
- type CipherType
- type ProxySettings
- type ShadowsocksAccount
- type ShadowsocksTcpAccount
- type TrojanAccount
- type VlessAccount
- type VmessAccount
- type XrayHandler
- func (x *XrayHandler) AddInboundUser(ctx context.Context, tag string, user Account) error
- func (x *XrayHandler) AddOutboundUser(ctx context.Context, tag string, user Account) error
- func (x *XrayHandler) AlertInbound(ctx context.Context, tag string, operation *serial.TypedMessage) error
- func (x *XrayHandler) AlertOutbound(ctx context.Context, tag string, operation *serial.TypedMessage) error
- func (x *XrayHandler) Close()
- func (x *XrayHandler) GetInboundStats(ctx context.Context, tag string, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) GetInboundsStats(ctx context.Context, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) GetOutboundStats(ctx context.Context, tag string, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) GetOutboundsStats(ctx context.Context, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) GetSysStats(ctx context.Context) (*common.BackendStatsResponse, error)
- func (x *XrayHandler) GetUserOnlineIpListStats(ctx context.Context, email string) (*common.StatsOnlineIpListResponse, error)
- func (x *XrayHandler) GetUserOnlineStats(ctx context.Context, email string) (*common.OnlineStatResponse, error)
- func (x *XrayHandler) GetUserStats(ctx context.Context, email string, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) GetUsersStats(ctx context.Context, reset bool) (*common.StatResponse, error)
- func (x *XrayHandler) QueryStats(ctx context.Context, pattern string, reset bool) (*command.QueryStatsResponse, error)
- func (x *XrayHandler) RemoveInboundUser(ctx context.Context, tag, email string) error
- func (x *XrayHandler) RemoveOutboundUser(ctx context.Context, tag, email string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CipherType_name = map[int32]string{ 5: "aes-128-gcm", 6: "aes-256-gcm", 7: "chacha20-poly1305", 8: "xchacha20-poly1305", 9: "none", } CipherType_value = map[string]int32{ "aes-128-gcm": 5, "aes-256-gcm": 6, "chacha20-poly1305": 7, "chacha20-ietf-poly1305": 7, "xchacha20-poly1305": 8, "xchacha20-ietf-poly1305": 8, "none": 9, } )
Enum value maps for CipherType.
Functions ¶
func ToTypedMessage ¶
func ToTypedMessage(account proto.Message) (*serial.TypedMessage, error)
Types ¶
type Account ¶
type Account interface {
GetEmail() string
GetLevel() uint32
Message() (*serial.TypedMessage, error)
}
type BaseAccount ¶
func (*BaseAccount) GetEmail ¶
func (ba *BaseAccount) GetEmail() string
func (*BaseAccount) GetLevel ¶
func (ba *BaseAccount) GetLevel() uint32
type CipherType ¶
type CipherType int32
const ( CipherType_AES_128_GCM CipherType = 5 CipherType_AES_256_GCM CipherType = 6 CipherType_CHACHA20_POLY1305 CipherType = 7 CipherType_XCHACHA20_POLY1305 CipherType = 8 CipherType_NONE CipherType = 9 )
type ProxySettings ¶
type ProxySettings struct {
Vmess *VmessAccount
Vless *VlessAccount
Trojan *TrojanAccount
Shadowsocks *ShadowsocksTcpAccount
Shadowsocks2022 *ShadowsocksAccount
}
type ShadowsocksAccount ¶
type ShadowsocksAccount struct {
BaseAccount
Password string `json:"password"`
}
func NewShadowsocksAccount ¶
func NewShadowsocksAccount(user *common.User) *ShadowsocksAccount
func (*ShadowsocksAccount) Message ¶
func (sa *ShadowsocksAccount) Message() (*serial.TypedMessage, error)
type ShadowsocksTcpAccount ¶
type ShadowsocksTcpAccount struct {
ShadowsocksAccount
Method string `json:"method"`
}
func NewShadowsocksTcpAccount ¶
func NewShadowsocksTcpAccount(user *common.User) *ShadowsocksTcpAccount
func (*ShadowsocksTcpAccount) CipherType ¶
func (sa *ShadowsocksTcpAccount) CipherType() string
func (*ShadowsocksTcpAccount) Message ¶
func (sa *ShadowsocksTcpAccount) Message() (*serial.TypedMessage, error)
type TrojanAccount ¶
type TrojanAccount struct {
BaseAccount
Password string `json:"password"`
}
func NewTrojanAccount ¶
func NewTrojanAccount(user *common.User) *TrojanAccount
func (*TrojanAccount) Message ¶
func (ta *TrojanAccount) Message() (*serial.TypedMessage, error)
type VlessAccount ¶
type VlessAccount struct {
BaseAccount
ID uuid.UUID `json:"id"`
Flow string `json:"flow"`
}
func NewVlessAccount ¶
func NewVlessAccount(user *common.User) (*VlessAccount, error)
func (*VlessAccount) Message ¶
func (va *VlessAccount) Message() (*serial.TypedMessage, error)
type VmessAccount ¶
type VmessAccount struct {
BaseAccount
ID uuid.UUID `json:"id"`
}
func NewVmessAccount ¶
func NewVmessAccount(user *common.User) (*VmessAccount, error)
func (*VmessAccount) Message ¶
func (va *VmessAccount) Message() (*serial.TypedMessage, error)
type XrayHandler ¶
type XrayHandler struct {
HandlerServiceClient *command.HandlerServiceClient
StatsServiceClient *statsService.StatsServiceClient
GrpcClient *grpc.ClientConn
}
func NewXrayAPI ¶
func NewXrayAPI(apiPort int) (*XrayHandler, error)
func (*XrayHandler) AddInboundUser ¶
func (*XrayHandler) AddOutboundUser ¶
func (*XrayHandler) AlertInbound ¶
func (x *XrayHandler) AlertInbound(ctx context.Context, tag string, operation *serial.TypedMessage) error
func (*XrayHandler) AlertOutbound ¶
func (x *XrayHandler) AlertOutbound(ctx context.Context, tag string, operation *serial.TypedMessage) error
func (*XrayHandler) Close ¶
func (x *XrayHandler) Close()
func (*XrayHandler) GetInboundStats ¶
func (x *XrayHandler) GetInboundStats(ctx context.Context, tag string, reset bool) (*common.StatResponse, error)
func (*XrayHandler) GetInboundsStats ¶
func (x *XrayHandler) GetInboundsStats(ctx context.Context, reset bool) (*common.StatResponse, error)
func (*XrayHandler) GetOutboundStats ¶
func (x *XrayHandler) GetOutboundStats(ctx context.Context, tag string, reset bool) (*common.StatResponse, error)
func (*XrayHandler) GetOutboundsStats ¶
func (x *XrayHandler) GetOutboundsStats(ctx context.Context, reset bool) (*common.StatResponse, error)
func (*XrayHandler) GetSysStats ¶
func (x *XrayHandler) GetSysStats(ctx context.Context) (*common.BackendStatsResponse, error)
func (*XrayHandler) GetUserOnlineIpListStats ¶
func (x *XrayHandler) GetUserOnlineIpListStats(ctx context.Context, email string) (*common.StatsOnlineIpListResponse, error)
func (*XrayHandler) GetUserOnlineStats ¶
func (x *XrayHandler) GetUserOnlineStats(ctx context.Context, email string) (*common.OnlineStatResponse, error)
func (*XrayHandler) GetUserStats ¶
func (x *XrayHandler) GetUserStats(ctx context.Context, email string, reset bool) (*common.StatResponse, error)
func (*XrayHandler) GetUsersStats ¶
func (x *XrayHandler) GetUsersStats(ctx context.Context, reset bool) (*common.StatResponse, error)
func (*XrayHandler) QueryStats ¶
func (x *XrayHandler) QueryStats(ctx context.Context, pattern string, reset bool) (*command.QueryStatsResponse, error)
func (*XrayHandler) RemoveInboundUser ¶
func (x *XrayHandler) RemoveInboundUser(ctx context.Context, tag, email string) error
func (*XrayHandler) RemoveOutboundUser ¶
func (x *XrayHandler) RemoveOutboundUser(ctx context.Context, tag, email string) error
Click to show internal directories.
Click to hide internal directories.