config

package
v0.0.0-...-03b039a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPath

func GetPath() string

Simple getter for configPath

Types

type Config

type Config struct {
	Upstreams []Upstream `yaml:"upstreams"`
	Rules     []Rule     `yaml:"rules"`
	Filepath  string     `yaml:"-"`
}

Config is the main configuration for the proxy

func Load

func Load() (*Config, error)

Load reads the configuration file and returns the configuration. It returns an error if the configuration file cannot be loaded.

func (Config) Dump

func (c Config) Dump() string

Dump the config to a string

func (Config) Write

func (c Config) Write() error

Write the config to the config file

type Rule

type Rule struct {
	Path      string `yaml:"path"`
	Upstream  string `yaml:"upstream"`
	MatchMode string `yaml:"matchMode"`
	Host      string `yaml:"host"`
	StripPath bool   `yaml:"stripPath"`
}

Rule sets host and/or path to match and the upstream to use

type Upstream

type Upstream struct {
	Name          string `yaml:"name"`
	Host          string `yaml:"host"`
	Port          int    `yaml:"port"`
	Scheme        string `yaml:"scheme"`
	NoHostRewrite bool   `yaml:"noHostRewrite"`
}

Upstream is a backend server

Jump to

Keyboard shortcuts

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