util

package
v0.0.0-...-b83bfb4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

constants.go

finder.go

firewall_utils.go

launcher_utils.go

Package util provides utility functions for detecting headless systems. Description: Linux-specific utility functions for detecting headless systems.

system_utils.go

user_utils.go

Index

Constants

This section is empty.

Variables

View Source
var (
	// I2CP_HOST is the i2cp host
	// Moved from: constant.go (non-platform-specific)
	I2CP_HOST string

	// I2CP_PORT is the i2cp port
	// Moved from: constant.go (non-platform-specific)
	I2CP_PORT string

	// WINDOWS_DEFAULT_LOCATION is the default location of the I2P router on Windows
	// Moved from: constant.go (non-platform-specific)
	WINDOWS_DEFAULT_LOCATION string = `C:\\Program Files\i2p\i2psvc.exe`

	// WINDOWS_ZERO_NSIS_DEFAULT_LOCATION is the default location of the I2P Zero router on Windows
	// Moved from: constant.go (non-platform-specific)
	WINDOWS_ZERO_NSIS_DEFAULT_LOCATION string = `C:\\Program Files\I2P-Zero\router\i2p-zero.exe`

	// I2PD_WINDOWS_DEFAULT_LOCATION is the default location of the I2Pd router on Windows
	// Moved from: constant.go (non-platform-specific)
	I2PD_WINDOWS_DEFAULT_LOCATION string = `C:\\Program Files\I2Pd\i2pd.exe`

	// LINUX_SYSTEM_LOCATION is the default location of the I2P router on Linux
	// Moved from: constant.go (non-platform-specific)
	LINUX_SYSTEM_LOCATION []string = []string{"/usr/bin/i2prouter", "/usr/sbin/i2prouter"}

	// I2PD_LINUX_SYSTEM_LOCATION is the default location of the I2Pd router on Linux
	// Moved from: constant.go (non-platform-specific)
	I2PD_LINUX_SYSTEM_LOCATION []string = []string{"/usr/sbin/i2pd", "/usr/bin/i2pd"}

	// I2P_ASUSER_HOME_LOCATION This is the path to the default I2P config directory when running as a user
	// Moved from: constant.go (non-platform-specific)
	I2P_ASUSER_HOME_LOCATION string = Inithome(Home())

	// HOME_DIRECTORY_LOCATION can use config/run from a user's $HOME directory, this is the path to that router
	// Moved from: constant.go (non-platform-specific)
	HOME_DIRECTORY_LOCATION string = Inithome("/i2p/i2prouter")

	// OSX_DEFAULT_LOCATION is the default location of the I2P router on OSX
	// Moved from: constant.go (non-platform-specific)
	OSX_DEFAULT_LOCATION string = Inithome("/Library/Application Support/i2p/clients.config")
)

Functions

func CheckFileExists

func CheckFileExists(path string) bool

CheckFileExists checks to see if a file exists at the given path and returns a boolean value. It returns true if the file exists, false otherwise. Moved from: util.go (non-platform-specific)

func CheckHeadlessness

func CheckHeadlessness() (bool, error)

CheckHeadlessness checks to see if the current environment is headless and returns a boolean value. it calls a platform-specific function in the background. it returns true if the system appears to be headless, false otherwise and any error encountered during detection. Moved from: util.go (non-platform-specific)

func CheckI2PIsInstalledDefaultLocation

func CheckI2PIsInstalledDefaultLocation() (bool, error)

CheckI2PIsInstalledDefaultLocation looks in various locations for the presence of an I2P router.

func CheckI2PUserName

func CheckI2PUserName() (string, error)

CheckI2PUserName looks in various locations for the presence of an I2P router and guesses the username it should run under. On Windows it returns the EXE name.

func FindI2PIsInstalledDefaultLocation

func FindI2PIsInstalledDefaultLocation() (string, error)

FindI2PIsInstalledDefaultLocation looks in various locations for the presence of an I2P router, reporting back the location

func GetFirewallPort

func GetFirewallPort() (string, error)

GetFirewallPort finds the configured UDP port of your I2P router to help configure firewalls. It does this by finding the router.config and reading it. This function will not work on I2Pd routers yet but it should be easy to add support once I get some more time to test and research it.

func Home

func Home() string

Home returns the path to the I2P(Java) home directory based on the current operating system. It returns a string containing the path to the I2P home directory. Moved from: util.go (non-platform-specific)

func Inithome

func Inithome(str string) string

Inithome returns the path to the user's home directory with the given string appended to the end. It panics if the user's home directory cannot be found. Moved from: util.go (non-platform-specific)

func IsHeadless

func IsHeadless() (bool, error)

IsHeadless determines if the current Linux system is running headless using multiple detection methods.

func UserFind

func UserFind() string

UserFind makes sure that we never misidentify the user account because of sudo

Types

This section is empty.

Jump to

Keyboard shortcuts

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