server

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DNSConfig

type DNSConfig struct {
	Server string
	Domain string
	Port   int64
}

DNSConfig DNS配置

type OnlineUser

type OnlineUser struct {
	SID int64
	IP  string
}

OnlineUser 在线用户

type OutboundConfig

type OutboundConfig struct {
	Tag      string
	Protocol string
	Settings map[string]string
}

OutboundConfig 出站配置

type Protocol

type Protocol struct {
	Type                          string
	Port                          int32
	Enable                        bool
	Security                      string
	SNI                           string
	AllowInsecure                 bool
	Fingerprint                   string
	RealityServerAddr             string
	RealityServerPort             int32
	RealityPrivateKey             string
	RealityPublicKey              string
	RealityShortId                string
	Transport                     string
	Host                          string
	Path                          string
	ServiceName                   string
	Cipher                        string
	ServerKey                     string
	Flow                          string
	HopPorts                      string
	HopInterval                   int32
	ObfsPassword                  string
	DisableSNI                    bool
	ReduceRtt                     bool
	UDPRelayMode                  string
	CongestionController          string
	Multiplex                     string
	PaddingScheme                 string
	UpMbps                        int32
	DownMbps                      int32
	Obfs                          string
	ObfsHost                      string
	ObfsPath                      string
	XhttpMode                     string
	XhttpExtra                    string
	Encryption                    string
	EncryptionMode                string
	EncryptionRtt                 string
	EncryptionTicket              string
	EncryptionServerPadding       string
	EncryptionPrivateKey          string
	EncryptionClientPadding       string
	EncryptionPassword            string
	Ratio                         float64
	CertMode                      string
	CertDNSProvider               string
	CertDNSEnv                    string
	SimnetPsk                     string
	SimnetKeyID                   int32
	SimnetTicketID                string
	SimnetPath                    string
	SimnetCarrier                 string
	SimnetAfEnabled               bool
	SimnetAfPathMode              string
	SimnetAfPathPrefix            string
	SimnetAfPathSuffix            string
	SimnetAfMagicMode             string
	SimnetAfResponseJitterMs      int32
	SimnetAfHandshakePolymorphism bool
	SimnetAfSettingsJitter        bool
	SimnetAfFakeHeaderInjection   bool
	SimnetReverseEnabled          bool
	SimnetReverseListenAddr       string
	SimnetReverseListenPort       int32
	SimnetReverseTargetHost       string
	SimnetReverseTargetPort       int32
	SimnetFallbackEnabled         bool
	SimnetFallbackTargetScheme    string
	SimnetFallbackTargetHost      string
	SimnetFallbackTargetPort      int32
	SimnetFallbackHostHeader      string
	SimnetFallbackTLSSNI          string

	// OmniFlow 基础配置
	OmniflowCarrier     string
	OmniflowPath        string
	OmniflowContentType string
	OmniflowProfilePath string
	OmniflowProfileJson string
	OmniflowServerHost  string
	OmniflowServerPort  int32
	OmniflowCaCertPath  string
	OmniflowTargetMeta  string
	OmniflowSpkiPin     string

	// OmniFlow H3 Fallback 策略
	OmniflowH3FallbackEnabled          bool
	OmniflowH3FallbackPolicy           string
	OmniflowH3FallbackTimeoutMs        int32
	OmniflowH3FallbackRetryBudget      int32
	OmniflowH3FallbackSmokeEnabled     bool
	OmniflowH3FallbackSmokeIntervalSec int32
	OmniflowH3FallbackSmokeTimeoutMs   int32

	// OmniFlow 连接管理
	OmniflowMaxAgeSec      int32
	OmniflowIdleTimeoutSec int32
	OmniflowMaxConnections int32

	// OmniFlow 抗指纹
	OmniflowAdaptiveTlsEnabled    bool
	OmniflowTlsFingerprint        string
	OmniflowSniMode               string
	OmniflowPaddingMode           string
	OmniflowTrafficShapingEnabled bool
	OmniflowAfEnabled             bool
	OmniflowAfPathMode            string
	OmniflowAfPathPrefix          string
	OmniflowAfPathSuffix          string
	OmniflowAfPathRotationSecs    int32
	OmniflowAfPathSkewSlots       int32

	// OmniFlow 同端口浏览器 Fallback 反向代理
	OmniflowFallbackEnabled      bool
	OmniflowFallbackTargetScheme string
	OmniflowFallbackTargetHost   string
	OmniflowFallbackTargetPort   int32
	OmniflowFallbackHostHeader   string
	OmniflowFallbackTLSSNI       string

	// OmniFlow 回退 Carrier
	OmniflowFallbackCarrierEnabled bool
	OmniflowFallbackConnectTunnel  bool
	OmniflowFallbackWssEnabled     bool
}

Protocol 协议配置

type ProtocolConfig

type ProtocolConfig struct {
	TrafficReportThreshold int64
	IPStrategy             string
	DNS                    []*DNSConfig
	Block                  []string
	Outbound               []*OutboundConfig
	Protocols              []*Protocol
	Total                  int32
}

ProtocolConfig 协议配置响应

type PushOnlineUsersRequest

type PushOnlineUsersRequest struct {
	ServerID  int64
	Protocol  string
	SecretKey string
	Users     []*OnlineUser
}

PushOnlineUsersRequest 推送在线用户请求

type PushServerStatusRequest

type PushServerStatusRequest struct {
	ServerID  int64
	Protocol  string
	SecretKey string
	CPU       float64
	Mem       float64
	Disk      float64
	UpdatedAt int64
}

PushServerStatusRequest 推送服务器状态请求

type PushUserTrafficRequest

type PushUserTrafficRequest struct {
	ServerID  int64
	Protocol  string
	SecretKey string
	Traffic   []*UserTraffic
}

PushUserTrafficRequest 推送用户流量请求

type ServerConfig

type ServerConfig struct {
	PushInterval int64
	PullInterval int64
	Protocol     string
	Config       string
}

ServerConfig 服务器配置

type ServerNodeRepo

type ServerNodeRepo interface {
	GetNodeSecret(ctx context.Context) (string, error)
	GetServerConfig(ctx context.Context, serverID int64, protocol string) (*ServerConfig, error)
	GetServerUserList(ctx context.Context, serverID int64, protocol string) ([]*ServerUser, error)
	PushUserTraffic(ctx context.Context, req *PushUserTrafficRequest) error
	PushServerStatus(ctx context.Context, req *PushServerStatusRequest) error
	PushOnlineUsers(ctx context.Context, req *PushOnlineUsersRequest) error
	QueryServerProtocolConfig(ctx context.Context, serverID int64) (*ProtocolConfig, error)
	SessionCheck(ctx context.Context, serverID int64, userID int64, identifier string, deviceLimit int64) (allowed bool, current int64, err error)
	SessionRelease(ctx context.Context, userID int64, identifier string) error
	GetDeviceCountMode(ctx context.Context) (string, error)
	GetDeviceAdmissionEnabled(ctx context.Context) (bool, error)
	GetUserDeviceLimit(ctx context.Context, userID int64) (int64, error)
}

ServerNodeRepo 节点服务器仓储接口

type ServerNodeUsecase

type ServerNodeUsecase struct {
	// contains filtered or unexported fields
}

ServerNodeUsecase 节点服务器用例

func NewServerNodeUsecase

func NewServerNodeUsecase(repo ServerNodeRepo, logger log.Logger) *ServerNodeUsecase

NewServerNodeUsecase 创建节点服务器用例

func (*ServerNodeUsecase) GetDeviceAdmissionEnabled

func (uc *ServerNodeUsecase) GetDeviceAdmissionEnabled(ctx context.Context) (bool, error)

GetDeviceAdmissionEnabled 获取设备准入控制全局开关

func (*ServerNodeUsecase) GetDeviceCountMode

func (uc *ServerNodeUsecase) GetDeviceCountMode(ctx context.Context) (string, error)

GetDeviceCountMode 获取设备计数模式

func (*ServerNodeUsecase) GetServerConfig

func (uc *ServerNodeUsecase) GetServerConfig(ctx context.Context, serverID int64, protocol, secretKey string) (*ServerConfig, error)

GetServerConfig 获取服务器配置

func (*ServerNodeUsecase) GetServerUserList

func (uc *ServerNodeUsecase) GetServerUserList(ctx context.Context, serverID int64, protocol, secretKey string) ([]*ServerUser, error)

GetServerUserList 获取服务器用户列表

func (*ServerNodeUsecase) PushOnlineUsers

func (uc *ServerNodeUsecase) PushOnlineUsers(ctx context.Context, req *PushOnlineUsersRequest) error

PushOnlineUsers 推送在线用户

func (*ServerNodeUsecase) PushServerStatus

func (uc *ServerNodeUsecase) PushServerStatus(ctx context.Context, req *PushServerStatusRequest) error

PushServerStatus 推送服务器状态

func (*ServerNodeUsecase) PushUserTraffic

func (uc *ServerNodeUsecase) PushUserTraffic(ctx context.Context, req *PushUserTrafficRequest) error

PushUserTraffic 推送用户流量

func (*ServerNodeUsecase) QueryServerProtocolConfig

func (uc *ServerNodeUsecase) QueryServerProtocolConfig(ctx context.Context, serverID int64, secretKey string, protocols []string) (*ProtocolConfig, error)

QueryServerProtocolConfig 查询服务器协议配置

func (*ServerNodeUsecase) SessionCheck

SessionCheck 设备准入检查

func (*ServerNodeUsecase) SessionRelease

SessionRelease 会话释放

type ServerUser

type ServerUser struct {
	ID          int64
	UUID        string
	SpeedLimit  int64
	DeviceLimit int64
}

ServerUser 服务器用户

type UserTraffic

type UserTraffic struct {
	SID      int64
	Upload   int64
	Download int64
}

UserTraffic 用户流量

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL