util

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCtxWithScope

func GetCtxWithScope(ctx context.Context, scope string) context.Context

GetCtxWithScope creates a new context with the given scope.

func GetCtxWithTraceId

func GetCtxWithTraceId(ctx context.Context) context.Context

GetCtxWithTraceId creates a new context with a generated trace ID.

func GetScopeFromCtx

func GetScopeFromCtx(ctx context.Context) (string, bool)

GetScopeFromCtx retrieves the scope from the context.

func GetTraceIdFromCtx

func GetTraceIdFromCtx(ctx context.Context) (string, bool)

GetTraceIdFromCtx retrieves the trace ID from the context.

func PrintColoredBanner

func PrintColoredBanner()

PrintColoredBanner prints a colored banner with the configuration details.

func SetOsProxy

func SetOsProxy(port uint16) error

SetOsProxy sets the system proxy settings on macOS.

func UnsetOsProxy

func UnsetOsProxy() error

UnsetOsProxy unsets the system proxy settings on macOS.

Types

type Args

type Args struct {
	Addr           string
	Port           uint16
	DnsAddr        string
	DnsPort        uint16
	DnsIPv4Only    bool
	EnableDoh      bool
	Debug          bool
	Silent         bool
	SystemProxy    bool
	Timeout        uint16
	AllowedPattern StringArray
	WindowSize     uint16
	Version        bool
}

func ParseArgs

func ParseArgs() *Args

ParseArgs parses command line arguments and returns an Args struct.

type Config

type Config struct {
	Addr            string
	Port            int
	DnsAddr         string
	DnsPort         int
	DnsIPv4Only     bool
	EnableDoh       bool
	Debug           bool
	Silent          bool
	SystemProxy     bool
	Timeout         int
	WindowSize      int
	AllowedPatterns []*regexp.Regexp
}

func GetConfig

func GetConfig() *Config

GetConfig returns the singleton instance of Config.

func (*Config) Load

func (c *Config) Load(args *Args)

Load populates the Config struct with values from the Args struct.

type StringArray

type StringArray []string

func (*StringArray) Set

func (arr *StringArray) Set(value string) error

func (*StringArray) String

func (arr *StringArray) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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