common

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Overview

Package common contains common initialization code and utilities for the Radiance application.

Index

Constants

View Source
const (
	Name = "lantern"

	// Placeholders to use in the request headers.
	ClientVersion = "9.0.0"
	Version       = "9.0.1"

	Platform = runtime.GOOS

	// filenames
	LogFileName        = "lantern.log"
	ConfigFileName     = "config.json"
	ServersFileName    = "servers.json"
	DefaultHTTPTimeout = (60 * time.Second)
)

Variables

View Source
var ErrNotImplemented = errors.New("not yet implemented")

ErrNotImplemented is returned by functions which have not yet been implemented. The existence of this error is temporary; this will go away when the API stabilized.

Functions

func Close

func Close(ctx context.Context) error

func DataPath

func DataPath() string

func Dev

func Dev() bool

Dev returns true if the application is running in development environment.

func Init

func Init(dataDir, logDir, logLevel string) error

Init initializes the common components of the application. This includes setting up the directories for data and logs, initializing the logger, and setting up reporting.

func IsAndroid

func IsAndroid() bool

func IsIOS

func IsIOS() bool

func IsMacOS

func IsMacOS() bool

func IsWindows

func IsWindows() bool

func LogPath

func LogPath() string

func Prod

func Prod() bool

Prod returns true if the application is running in production environment. Treating ENV == "" as production is intentional: if RADIANCE_ENV is unset, we default to production mode to ensure the application runs with safe, non-debug settings.

func SetPathsForTesting

func SetPathsForTesting(t *testing.T)

Types

type UserChangeEvent

type UserChangeEvent struct {
	events.Event
	Old UserInfo
	New UserInfo
}

type UserInfo

type UserInfo interface {
	DeviceID() string
	LegacyID() int64
	LegacyToken() string
	SetData(*protos.LoginResponse) error
	GetData() (*protos.LoginResponse, error)
	Locale() string
	SetLocale(string)
	AccountType() string
}

UserInfo is an interface that defines the methods for user configuration

func NewUserConfig

func NewUserConfig(deviceID, dataDir, locale string) UserInfo

NewUserConfig creates a new UserInfo object

Directories

Path Synopsis
Package atomicfile provides functions to read and write files atomically.
Package atomicfile provides functions to read and write files atomically.
Package env is responsible for loading radiance configuration based on a order of precedence (environment variables > configurations set at .env file).
Package env is responsible for loading radiance configuration based on a order of precedence (environment variables > configurations set at .env file).

Jump to

Keyboard shortcuts

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