server

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerService

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

ServerService is the core structure of Steam server query service Steam服务器查询服务核心结构体 Encapsulates all A2S protocol-related server information query methods, and manages underlying communication through internal client

func NewServerService

func NewServerService(c *client.Client) *ServerService

NewServerService creates a ServerService instance 创建ServerService实例

func (*ServerService) Client added in v1.0.3

func (s *ServerService) Client() *client.Client

Client 对外暴露 client

func (*ServerService) Close added in v1.0.2

func (s *ServerService) Close() error

Close 释放ServerService资源

func (*ServerService) GetServerDetail

func (s *ServerService) GetServerDetail(addr string) (models.SteamServerResponse, error)

GetServerDetail aggregately gets the complete information of a single server (basic info + players + rules) 聚合获取单个服务器的完整信息 Internally calls three independent methods: QueryServerInfo/QueryServerPlayers/QueryServerRules Parameters:

  • addr: Server address in the format of "ip:port"

func (*ServerService) GetServerDetailList

func (s *ServerService) GetServerDetailList(
	addrs []string,
	qps float64,
	burst int,
	timeout time.Duration,
	retry int,
) ([]models.SteamServerResponse, []error, error)

GetServerDetailList 批量查询多个服务器的完整聚合信息(带限流、重试、超时) 内部调用GetServerDetail聚合接口, 采用并发方式查询, 保证结果顺序与输入地址列表一致 支持指数退避重试策略, 线程安全的结果写入机制 参数:

  • addrs: 服务器地址列表, 格式为["ip:port", ...]
  • qps: 每秒最大请求数(限流)
  • burst: 突发请求上限(限流)
  • timeout: 整体超时时间
  • retry: 单个请求重试次数

返回值:

  • []models.SteamServerResponse: 批量聚合结果(与输入地址一一对应)
  • []error: 每个地址对应的错误信息
  • error: 全局错误(如上下文超时、限流失效)

GetServerDetailList batch queries the complete aggregated information of multiple servers (with rate limit, retry, timeout) Internally calls the GetServerDetail aggregation interface, uses concurrent query method to ensure the result order is consistent with the input address list Supports exponential backoff retry strategy and thread-safe result writing mechanism Parameters:

  • addrs: Server address list in the format of ["ip:port", ...]
  • qps: Maximum requests per second (rate limit)
  • burst: Maximum burst requests (rate limit)
  • timeout: Overall timeout time
  • retry: Number of retries for a single request

Return values:

  • []models.SteamServerResponse: Batch aggregation results (one-to-one correspondence with input addresses)
  • []error: Error information corresponding to each address
  • error: Global error (such as context timeout, rate limit failure)

func (*ServerService) QueryServerInfo

func (s *ServerService) QueryServerInfo(addr string) (a2s.ServerInfo, error)

QueryServerInfo queries the basic information of a single server 查询单个服务器的基础信息 Parameters:

  • addr: Server address in the format of "ip:port"

func (*ServerService) QueryServerInfoList

func (s *ServerService) QueryServerInfoList(
	addrs []string,
	qps float64,
	burst int,
	timeout time.Duration,
	retry int,
) ([]a2s.ServerInfo, []error, error)

QueryServerInfoList 批量查询多个服务器的基础信息(带限流、重试、超时) 采用并发方式查询, 保证结果顺序与输入地址列表一致, 支持指数退避重试策略 参数:

  • addrs: 服务器地址列表, 格式为["ip:port", ...]
  • qps: 每秒最大请求数(限流)
  • burst: 突发请求上限(限流)
  • timeout: 整体超时时间
  • retry: 单个请求重试次数

返回值:

  • []a2s.ServerInfo: 批量查询结果(与输入地址列表一一对应)
  • []error: 每个地址对应的错误信息(nil表示成功)
  • error: 全局错误(如上下文超时、限流失效)

QueryServerInfoList batch queries the basic information of multiple servers (with rate limit, retry, timeout) Uses concurrent query method to ensure the result order is consistent with the input address list, supports exponential backoff retry strategy Parameters:

  • addrs: Server address list in the format of ["ip:port", ...]
  • qps: Maximum requests per second (rate limit)
  • burst: Maximum burst requests (rate limit)
  • timeout: Overall timeout time
  • retry: Number of retries for a single request

Return values:

  • []a2s.ServerInfo: Batch query results (one-to-one correspondence with input address list)
  • []error: Error information corresponding to each address (nil means success)
  • error: Global error (such as context timeout, rate limit failure)

func (*ServerService) QueryServerPlayers

func (s *ServerService) QueryServerPlayers(addr string) (a2s.PlayerInfo, error)

QueryServerPlayers queries the player information of a single server 查询单个服务器的玩家信息 Each request creates an independent A2S Client to avoid concurrent resource competition and ensure thread safety Parameters:

  • addr: Server address in the format of "ip:port"

func (*ServerService) QueryServerPlayersList

func (s *ServerService) QueryServerPlayersList(
	addrs []string,
	qps float64,
	burst int,
	timeout time.Duration,
	retry int,
) ([]a2s.PlayerInfo, []error, error)

QueryServerPlayersList 批量查询多个服务器的玩家信息(带限流、重试、超时) 采用并发方式查询, 保证结果顺序与输入地址列表一致, 支持指数退避重试策略 参数/返回值格式与QueryServerInfoList完全一致 QueryServerPlayersList batch queries the player information of multiple servers (with rate limit, retry, timeout) Uses concurrent query method to ensure the result order is consistent with the input address list, supports exponential backoff retry strategy Parameter/return value format is exactly the same as QueryServerInfoList

func (*ServerService) QueryServerRules

func (s *ServerService) QueryServerRules(addr string) (a2s.RulesInfo, error)

QueryServerRules queries the rule information of a single server 查询单个服务器的规则信息 Each request creates an independent A2S Client to avoid concurrent resource competition and ensure thread safety Parameters:

  • addr: Server address in the format of "ip:port"

func (*ServerService) QueryServerRulesList

func (s *ServerService) QueryServerRulesList(
	addrs []string,
	qps float64,
	burst int,
	timeout time.Duration,
	retry int,
) ([]a2s.RulesInfo, []error, error)

QueryServerRulesList 批量查询多个服务器的规则信息(带限流、重试、超时) 采用并发方式查询, 保证结果顺序与输入地址列表一致, 支持指数退避重试策略 参数/返回值格式与QueryServerInfoList完全一致 QueryServerRulesList batch queries the rule information of multiple servers (with rate limit, retry, timeout) Uses concurrent query method to ensure the result order is consistent with the input address list, supports exponential backoff retry strategy Parameter/return value format is exactly the same as QueryServerInfoList

Jump to

Keyboard shortcuts

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