report

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegisterAPI = "/basic/register" // 模块注册接口
)

Variables

This section is empty.

Functions

func FreePort

func FreePort() (int, error)

FreePort returns a free TCP port by opening a listener on port 0.

func GatewayPort

func GatewayPort() (int, error)

GatewayPort returns the gateway port from the environment variable or a free port.

func IsGatewayMode

func IsGatewayMode() bool

IsGatewayMode checks if the application is running in gateway mode. It returns true if GATEWAY_MODE is set to "true" and GATEWAY_PORT is valid.

func ModulePort

func ModulePort() (int, error)

ModulePort returns the module port from the environment variable or a free port.

func RegisterModule

func RegisterModule(port int) error

RegisterModule registers a module with the gateway.

Types

type RegisterResponse

type RegisterResponse struct {
	Code    int    `json:"code"`    // 响应代码
	Message string `json:"message"` // 响应信息
	Data    struct {
		Success bool   `json:"success"` // 注册是否成功
		Message string `json:"message"` // 返回信息
	} `json:"data"` // 响应数据
}

RegisterResponse 模块注册响应参数

type RegisterServiceRequest

type RegisterServiceRequest struct {
	Secret         string `json:"secret"`          // 通讯密钥
	ProxyPath      string `json:"proxy_path"`      // 代理路径
	ServiceURL     string `json:"service_url"`     // 服务地址
	Repository     string `json:"repository"`      // 服务代码仓库
	ServiceName    string `json:"service_name"`    // 服务名称
	HeartbeatURL   string `json:"heartbeat_url"`   // 心跳检测地址
	ServiceVersion string `json:"service_version"` // 服务版本
}

Jump to

Keyboard shortcuts

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