config

package
v0.0.0-...-a8938b0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config parses the config file

Index

Constants

View Source
const (
	ActionStrip cfAction = iota
	ActionIgnore
)

Variables

This section is empty.

Functions

func LoadFile

func LoadFile(filename string, c *Config) error

func LoadReader

func LoadReader(r io.Reader, c *Config) error

Types

type API

type API struct {
	Addr string `json:"addr"`
}

type Config

type Config struct {
	API     API            `json:"api"`
	Proxy   Proxy          `json:"proxy"`
	Storage Storage        `json:"storage"`
	Log     *logrus.Logger `json:"-"`
}

func New

func New(opts ConfigOpts) (Config, error)

type ConfigOpts

type ConfigOpts struct {
	AddrAPI   string
	AddrProxy string
	ConfFile  string
	Log       *logrus.Logger
}

type Filter

type Filter struct {
	URLPrefixS string              `json:"urlPrefix"`
	URLPrefix  *url.URL            `json:"-"`
	Method     string              `json:"method"`
	ReqHeader  map[string]cfAction `json:"reqHeader"`
	RespHeader map[string]cfAction `json:"respHeader"`
	ReqQuery   map[string]cfAction `json:"reqQuery"`
	BodyForm   map[string]cfAction `json:"bodyForm"`
}

type Proxy

type Proxy struct {
	Addr    string   `json:"addr"`
	Filters []Filter `json:"filters"`
}

type Storage

type Storage struct {
	Kind      string `json:"kind"`
	Directory string `json:"directory"`
}

Jump to

Keyboard shortcuts

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