libv2ray

package module
v0.0.0-...-5b1a486 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: LGPL-3.0 Imports: 22 Imported by: 0

README

AndroidLibXrayLite

Build requirements

  • JDK
  • Android SDK
  • Go
  • gomobile

Build instructions

  1. git clone [repo] && cd AndroidLibXrayLite
  2. gomobile init
  3. go mod tidy -v
  4. gomobile bind -v -androidapi 21 -ldflags='-s -w' ./

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVersionX

func CheckVersionX() string

CheckVersionX returns the library and Xray versions

func InitCoreEnv

func InitCoreEnv(envPath string, key string)

InitCoreEnv initializes environment variables and file system handlers for the core It sets up asset path, certificate path, XUDP base key and customizes the file reader to support Android asset system

func MeasureOutboundDelay

func MeasureOutboundDelay(ConfigureFileContent string, url string) (int64, error)

MeasureOutboundDelay measures the outbound delay for a given configuration and URL

Types

type CoreCallbackHandler

type CoreCallbackHandler interface {
	Startup() int
	Shutdown() int
	OnEmitStatus(int, string) int
}

CoreCallbackHandler defines interface for receiving callbacks and notifications from the core service

type CoreController

type CoreController struct {
	CallbackHandler CoreCallbackHandler

	IsRunning bool
	// contains filtered or unexported fields
}

CoreController represents a controller for managing Xray core instance lifecycle

func NewCoreController

func NewCoreController(s CoreCallbackHandler) *CoreController

NewCoreController initializes and returns a new CoreController instance Sets up the console log handler and associates it with the provided callback handler

func (*CoreController) MeasureDelay

func (x *CoreController) MeasureDelay(url string) (int64, error)

MeasureDelay measures network latency to a specified URL through the current core instance Uses a 12-second timeout context and returns the round-trip time in milliseconds An error is returned if the connection fails or returns an unexpected status

func (*CoreController) QueryStats

func (x *CoreController) QueryStats(tag string, direct string) int64

QueryStats retrieves and resets traffic statistics for a specific outbound tag and direction Returns the accumulated traffic value and resets the counter to zero Returns 0 if the stats manager is not initialized or the counter doesn't exist

func (*CoreController) StartLoop

func (x *CoreController) StartLoop(configContent string) (err error)

StartLoop initializes and starts the core processing loop Thread-safe method that configures and runs the Xray core with the provided configuration Returns immediately if the core is already running

func (*CoreController) StopLoop

func (x *CoreController) StopLoop() error

StopLoop safely stops the core processing loop and releases resources Thread-safe method that shuts down the core instance and triggers necessary callbacks

Jump to

Keyboard shortcuts

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