config

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFlags

func ApplyFlags(cfg *Config, visit func(fn func(*flag.Flag)))

ApplyFlags overrides config fields with explicitly-set CLI flags. Only flags the user actually passed on the command line are applied.

func LoadOrCreateToken

func LoadOrCreateToken(cfg *Config, dataDir string) error

LoadOrCreateToken ensures cfg.MCPToken is set. It migrates from the legacy mcp-token file if present, otherwise generates a new 32-byte hex token. The config is saved after the token is set.

Types

type Config

type Config struct {
	ProxyPort      int                        `json:"proxy_port"`
	MCPEnabled     bool                       `json:"mcp_enabled"`
	MCPAddr        string                     `json:"mcp_addr"`
	MCPToken       string                     `json:"mcp_token"`
	BufferSize     int                        `json:"buffer_size"`
	ThrottlePreset string                     `json:"throttle_preset"`
	ListMode       string                     `json:"list_mode"`
	TreeGroupBy    string                     `json:"tree_group_by"`
	ProtoPaths     []string                   `json:"proto_paths,omitempty"`
	ProtoIncludes  []string                   `json:"proto_includes,omitempty"`
	ProtoHosts     map[string]ProtoHostConfig `json:"proto_hosts,omitempty"`
}

Config holds persistent httpmon settings stored in ~/.httpmon/config.json.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config with sensible defaults.

func Load

func Load(dataDir string) (*Config, error)

Load reads config.json from dataDir. Returns defaults if the file doesn't exist.

func (*Config) Save

func (c *Config) Save(dataDir string) error

Save writes the config as indented JSON to dataDir/config.json.

type ProtoHostConfig added in v0.1.13

type ProtoHostConfig struct {
	Paths    []string `json:"paths"`
	Includes []string `json:"includes,omitempty"`
}

ProtoHostConfig maps a host pattern to its own set of .proto files.

Jump to

Keyboard shortcuts

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