libv2ray

package module
v0.0.0-...-d0c6c4a Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: LGPL-3.0 Imports: 29 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 24 -trimpath -ldflags='-s -w -buildid= -checklinkname=0' ./

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 FetchQuicCertSha256

func FetchQuicCertSha256(requestJSON string) string

func FetchTlsCertSha256

func FetchTlsCertSha256(requestJSON string) string

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

func ReconcileBrowserDialer

func ReconcileBrowserDialer(dialerAddr string)

ReconcileBrowserDialer updates the browser dialer address and reloads its configuration If the dialer address is empty, it will disable the browser dialer and close existing connections

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) QueryAllOutboundTrafficStats

func (x *CoreController) QueryAllOutboundTrafficStats() string

QueryAllOutboundTrafficStats retrieves and resets all outbound traffic counters. Returns a single-line text in format: tag,direction,value;tag,direction,value; Returns an empty string if the stats manager is not initialized or no counters exist.

func (*CoreController) StartLoop

func (x *CoreController) StartLoop(configContent string, tunFd int32) (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