Documentation
¶
Overview ¶
Service assembly for the node-facing server API subdomain of the network module: config pulls, user lists, status/traffic pushes. Only the module facade may reach it.
Index ¶
- Constants
- type AnyTLSNode
- type Deps
- type GetServerConfigLogic
- type GetServerUserListLogic
- type Hysteria2Node
- type PushOnlineUsersLogic
- type QueryServerProtocolConfigLogic
- type RequestMeta
- type ResponseMeta
- type SecurityConfig
- type ServerPushStatusLogic
- type ServerPushUserTrafficLogic
- type Service
- func (s *Service) GetServerConfig(ctx context.Context, req *dto.GetServerConfigRequest, meta RequestMeta) (*dto.GetServerConfigResponse, ResponseMeta, error)
- func (s *Service) GetServerUserList(ctx context.Context, req *dto.GetServerUserListRequest, meta RequestMeta) (*dto.GetServerUserListResponse, ResponseMeta, error)
- func (s *Service) PushOnlineUsers(ctx context.Context, req *dto.OnlineUsersRequest) error
- func (s *Service) QueryServerProtocolConfig(ctx context.Context, req *dto.QueryServerConfigRequest) (*dto.QueryServerConfigResponse, error)
- func (s *Service) ServerPushStatus(ctx context.Context, req *dto.ServerPushStatusRequest) error
- func (s *Service) ServerPushUserTraffic(ctx context.Context, req *dto.ServerPushUserTrafficRequest) error
- type ShadowsocksNode
- type Snapshot
- type TransportConfig
- type TrojanNode
- type TuicNode
- type VlessNode
- type VmessNode
Constants ¶
View Source
const ( Unchanged = "Unchanged" ShadowSocks = "shadowsocks" Vmess = "vmess" Vless = "vless" Trojan = "trojan" AnyTLS = "anytls" Tuic = "tuic" ShadowsocksR = "shadowsocksr" Mieru = "mieru" Naive = "naive" Snell = "snell" Hysteria = "hysteria" // Deprecated: Hysteria2 is deprecated, use Hysteria instead // TODO: remove in future versions Hysteria2 = "hysteria2" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnyTLSNode ¶
type AnyTLSNode struct {
Port uint16 `json:"port"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
type Deps ¶
type Deps struct {
Store repository.Store
Redis *redis.Client
// Config snapshots the runtime-mutable settings per request.
Config func() Snapshot
// Multiplier returns the node traffic multiplier in effect at the given
// time; nil means no multiplier is configured.
Multiplier func(at time.Time) float32
}
Deps declares the subdomain's dependencies; the module facade forwards them from the composition root.
type GetServerConfigLogic ¶
func (*GetServerConfigLogic) GetServerConfig ¶
func (l *GetServerConfigLogic) GetServerConfig(req *dto.GetServerConfigRequest) (resp *dto.GetServerConfigResponse, err error)
func (*GetServerConfigLogic) ResponseMeta ¶
func (l *GetServerConfigLogic) ResponseMeta() ResponseMeta
type GetServerUserListLogic ¶
func (*GetServerUserListLogic) GetServerUserList ¶
func (l *GetServerUserListLogic) GetServerUserList(req *dto.GetServerUserListRequest) (resp *dto.GetServerUserListResponse, err error)
func (*GetServerUserListLogic) ResponseMeta ¶
func (l *GetServerUserListLogic) ResponseMeta() ResponseMeta
type Hysteria2Node ¶
type Hysteria2Node struct {
Port uint16 `json:"port"`
HopPorts string `json:"hop_ports"`
HopInterval int `json:"hop_interval"`
ObfsPassword string `json:"obfs_password"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
type PushOnlineUsersLogic ¶
func (*PushOnlineUsersLogic) PushOnlineUsers ¶
func (l *PushOnlineUsersLogic) PushOnlineUsers(req *dto.OnlineUsersRequest) error
type QueryServerProtocolConfigLogic ¶
type QueryServerProtocolConfigLogic struct {
logger.Logger
// contains filtered or unexported fields
}
func (*QueryServerProtocolConfigLogic) QueryServerProtocolConfig ¶
func (l *QueryServerProtocolConfigLogic) QueryServerProtocolConfig(req *dto.QueryServerConfigRequest) (resp *dto.QueryServerConfigResponse, err error)
type RequestMeta ¶
type RequestMeta struct {
IfNoneMatch string
}
type ResponseMeta ¶
func NewResponseMeta ¶
func NewResponseMeta() ResponseMeta
func (*ResponseMeta) SetHeader ¶
func (m *ResponseMeta) SetHeader(key, value string)
type SecurityConfig ¶
type SecurityConfig struct {
SNI string `json:"sni"`
AllowInsecure *bool `json:"allow_insecure"`
Fingerprint string `json:"fingerprint"`
RealityServerAddress string `json:"reality_server_addr"`
RealityServerPort int `json:"reality_server_port"`
RealityPrivateKey string `json:"reality_private_key"`
RealityPublicKey string `json:"reality_public_key"`
RealityShortId string `json:"reality_short_id"`
RealityMldsa65seed string `json:"reality_mldsa65seed"`
PaddingScheme string `json:"padding_scheme"`
}
type ServerPushStatusLogic ¶
func (*ServerPushStatusLogic) ServerPushStatus ¶
func (l *ServerPushStatusLogic) ServerPushStatus(req *dto.ServerPushStatusRequest) error
type ServerPushUserTrafficLogic ¶
func (*ServerPushUserTrafficLogic) ServerPushUserTraffic ¶
func (l *ServerPushUserTrafficLogic) ServerPushUserTraffic(req *dto.ServerPushUserTrafficRequest) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the node-facing API entry point used by the network facade.
func NewService ¶
func (*Service) GetServerConfig ¶
func (s *Service) GetServerConfig(ctx context.Context, req *dto.GetServerConfigRequest, meta RequestMeta) (*dto.GetServerConfigResponse, ResponseMeta, error)
func (*Service) GetServerUserList ¶
func (s *Service) GetServerUserList(ctx context.Context, req *dto.GetServerUserListRequest, meta RequestMeta) (*dto.GetServerUserListResponse, ResponseMeta, error)
func (*Service) PushOnlineUsers ¶
func (*Service) QueryServerProtocolConfig ¶
func (s *Service) QueryServerProtocolConfig(ctx context.Context, req *dto.QueryServerConfigRequest) (*dto.QueryServerConfigResponse, error)
func (*Service) ServerPushStatus ¶
func (*Service) ServerPushUserTraffic ¶
type ShadowsocksNode ¶
type Snapshot ¶
type Snapshot struct {
Node config.NodeConfig
Subscribe config.SubscribeConfig
}
Snapshot is the per-request view of the runtime-mutable settings the node API consumes.
type TransportConfig ¶
type TrojanNode ¶
type TrojanNode struct {
Port uint16 `json:"port"`
Network string `json:"transport"`
TransportConfig *TransportConfig `json:"transport_config"`
Security string `json:"security"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
type TuicNode ¶
type TuicNode struct {
Port uint16 `json:"port"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
type VlessNode ¶
type VlessNode struct {
Port uint16 `json:"port"`
Flow string `json:"flow"`
Network string `json:"transport"`
TransportConfig *TransportConfig `json:"transport_config"`
Security string `json:"security"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
type VmessNode ¶
type VmessNode struct {
Port uint16 `json:"port"`
Network string `json:"transport"`
TransportConfig *TransportConfig `json:"transport_config"`
Security string `json:"security"`
SecurityConfig *SecurityConfig `json:"security_config"`
}
Click to show internal directories.
Click to hide internal directories.