server

package
v0.0.0-...-ebafd5e Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildInfo = struct {
	Version   string
	BuildTime string
	GitCommit string
	GoVersion string
}{
	Version:   version.Version,
	BuildTime: time.Now().Format(time.RFC3339),
	GitCommit: version.CommitID,
	GoVersion: runtime.Version(),
}

BuildInfo contains build-time information

Functions

func GetBuildID

func GetBuildID() string

GetBuildID returns a unique build identifier

Types

type AutoStartManager

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

AutoStartManager manages automatic server startup

func NewAutoStartManager

func NewAutoStartManager(serverPort int) *AutoStartManager

NewAutoStartManager creates a new auto-start manager

func (*AutoStartManager) EnsureServerRunning

func (m *AutoStartManager) EnsureServerRunning() error

EnsureServerRunning ensures the GBOX server is running, starting it if necessary

func (*AutoStartManager) IsServerRunning

func (m *AutoStartManager) IsServerRunning() bool

IsServerRunning returns whether the server is running

func (*AutoStartManager) StopServer

func (m *AutoStartManager) StopServer() error

StopServer stops the background server

type DeviceKeeper

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

func NewDeviceKeeper

func NewDeviceKeeper() (*DeviceKeeper, error)

func (*DeviceKeeper) CleanupExpiredDeviceInfos

func (dm *DeviceKeeper) CleanupExpiredDeviceInfos()

CleanupExpiredDeviceInfos removes all expired entries from cache

func (*DeviceKeeper) Close

func (dm *DeviceKeeper) Close()

func (*DeviceKeeper) ConnectAPWithDeviceId

func (dm *DeviceKeeper) ConnectAPWithDeviceId(serialKey, deviceId, deviceType, osType string) error

ConnectAPWithDeviceId connects to AP using known serialKey (session key) and deviceId (UUID). Used after register when both are known so the token API always receives UUID, not serialno.

func (*DeviceKeeper) GetDeviceInfo

func (dm *DeviceKeeper) GetDeviceInfo(key string) *handlers.DeviceDTO

GetDeviceInfo gets the complete device information from cache by serialno, deviceId, or regId Returns nil if not found or expired

func (*DeviceKeeper) IsDeviceConnected

func (dm *DeviceKeeper) IsDeviceConnected(serial string) bool

IsDeviceConnected checks if a device is currently connected to AP

func (*DeviceKeeper) ReconnectRegisteredDevices

func (dm *DeviceKeeper) ReconnectRegisteredDevices() error

ReconnectRegisteredDevices reconnects all registered devices on server start This is called after server startup to restore device connections

func (*DeviceKeeper) Start

func (dm *DeviceKeeper) Start() error

type DeviceMap

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

func NewDeviceMap

func NewDeviceMap() *DeviceMap

func (*DeviceMap) Delete

func (dm *DeviceMap) Delete(serial, token string) bool

func (*DeviceMap) DeleteForce

func (dm *DeviceMap) DeleteForce(serial string)

func (*DeviceMap) Get

func (dm *DeviceMap) Get(serial string) (*DeviceSession, bool)

func (*DeviceMap) Len

func (dm *DeviceMap) Len() int

func (*DeviceMap) Set

func (dm *DeviceMap) Set(serial string, session *DeviceSession) *DeviceSession

type DeviceSession

type DeviceSession struct {
	Mux              *smux.Session
	Token            string
	Serial           string
	DeviceType       string // mobile or desktop
	OsType           string // android, linux, windows, macos
	ReconnectAttempt int    // Current reconnection attempt count
	MaxReconnect     int    // Maximum reconnection attempts (default: 5)
	LastError        error  // Last connection error
}

type GBoxServer

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

GBoxServer is the unified server for all gbox services

func NewGBoxServer

func NewGBoxServer(port int) *GBoxServer

NewGBoxServer creates a new unified gbox server

func (*GBoxServer) ConnectAP

func (s *GBoxServer) ConnectAP(serial string) error

func (*GBoxServer) ConnectAPWithDeviceId

func (s *GBoxServer) ConnectAPWithDeviceId(serialKey, deviceId, deviceType, osType string) error

func (*GBoxServer) CreateBridge

func (s *GBoxServer) CreateBridge(deviceSerial string) error

CreateBridge creates a bridge for device

func (*GBoxServer) DisconnectAP

func (s *GBoxServer) DisconnectAP(serial string) error

func (*GBoxServer) GetBridge

func (s *GBoxServer) GetBridge(deviceSerial string) (handlers.Bridge, bool)

GetBridge gets a bridge by device serial

func (*GBoxServer) GetBuildID

func (s *GBoxServer) GetBuildID() string

GetBuildID returns build ID

func (*GBoxServer) GetDeviceInfo

func (s *GBoxServer) GetDeviceInfo(serial string) interface{}

func (*GBoxServer) GetDeviceReconnectState

func (s *GBoxServer) GetDeviceReconnectState(serial string) interface{}

func (*GBoxServer) GetPort

func (s *GBoxServer) GetPort() int

GetPort returns the server port

func (*GBoxServer) GetSerialByDeviceId

func (s *GBoxServer) GetSerialByDeviceId(deviceId string) string

func (*GBoxServer) GetStaticFS

func (s *GBoxServer) GetStaticFS() fs.FS

GetStaticFS returns static file system

func (*GBoxServer) GetUptime

func (s *GBoxServer) GetUptime() time.Duration

GetUptime returns server uptime

func (*GBoxServer) GetVersion

func (s *GBoxServer) GetVersion() string

GetVersion returns version info

func (*GBoxServer) IsADBExposeRunning

func (s *GBoxServer) IsADBExposeRunning() bool

IsADBExposeRunning returns ADB expose status

func (*GBoxServer) IsDeviceConnected

func (s *GBoxServer) IsDeviceConnected(serial string) bool

func (*GBoxServer) IsRunning

func (s *GBoxServer) IsRunning() bool

IsRunning returns whether the server is running

func (*GBoxServer) ListBridges

func (s *GBoxServer) ListBridges() []string

ListBridges returns list of bridge device serials

func (*GBoxServer) ListPortForwards

func (s *GBoxServer) ListPortForwards() interface{}

ListPortForwards lists all active port forwards This method is kept for ServerService interface compatibility

func (*GBoxServer) ReconnectRegisteredDevices

func (s *GBoxServer) ReconnectRegisteredDevices() error

func (*GBoxServer) RemoveBridge

func (s *GBoxServer) RemoveBridge(deviceSerial string)

RemoveBridge removes a bridge

func (*GBoxServer) Start

func (s *GBoxServer) Start() error

Start starts the unified server

func (*GBoxServer) StartPortForward

func (s *GBoxServer) StartPortForward(boxID string, localPorts, remotePorts []int) error

StartPortForward starts port forwarding for ADB expose This method is kept for ServerService interface compatibility but ADB functionality is now handled by ADBExposeHandlers

func (*GBoxServer) Stop

func (s *GBoxServer) Stop() error

Stop stops the server

func (*GBoxServer) StopPortForward

func (s *GBoxServer) StopPortForward(boxID string) error

StopPortForward stops port forwarding for ADB expose This method is kept for ServerService interface compatibility

func (*GBoxServer) UpdateDeviceInfo

func (s *GBoxServer) UpdateDeviceInfo(device interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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