reproksie

package
v0.0.0-...-bc8e691 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	AppConfig
	// contains filtered or unexported fields
}

App parses the given arguments and starts a new reverse proxy service

func NewApp

func NewApp(config AppConfig) *App

NewApp creates a new App with the given config data.

func (*App) Run

func (app *App) Run(args []string) error

Run starts a new reverse proxy service, while parsing the given arguments.

func (*App) Shutdown

func (app *App) Shutdown(ctx context.Context)

Shutdown gracefully shuts the proxy service down

type AppConfig

type AppConfig struct {
	Name    string
	Author  string
	Version string
	Usage   string
}

AppConfig holds all configurable data such as usage, name, author, etc.

type Application

type Application struct {
	Domain   string
	Port     int
	Protocol Protocol
	Path     string
}

Application can be any program running on a server that is accessable through a port. Reproksie redirects requests on the Application `host` from entrypoints to Application's `port`.

type Config

type Config struct {
	EntryPoints  []*EntryPoint
	Applications []*Application
	LogPath      string `json:"log_path"`
	Logger       *log.Logger
}

Config holds all configuration data needed to setup Reproksie.

func ParseConfig

func ParseConfig(parser ConfigParser, data []byte) (*Config, error)

ParseConfig parses the provided json data and sets all configuration that reproksie needs.

type ConfigParser

type ConfigParser interface {
	Parse(data []byte) (*Config, error)
}

ConfigParser is an interface that allows for parsing configurations based on their extension.

type EntryPoint

type EntryPoint struct {
	Name     string
	Address  string
	Protocol Protocol
	TLS      TLS
}

EntryPoint is the EntryPoint of a request. Reproksie will then serve the request to the correct application.

type JSONParser

type JSONParser struct{}

JSONParser is a JSON parser that unmarshals a json config file into Reproksie's config

func (*JSONParser) Parse

func (j *JSONParser) Parse(data []byte) (*Config, error)

Parse parses the `json` data into a config file.

type Protocol

type Protocol string

Protocol is the web protocol used for the request. Either `http` or `https`.

const (
	//Secure connection using TLS (https)
	Secure Protocol = "https"
	//NonSecure connection
	NonSecure Protocol = "http"
)

type TLS

type TLS struct {
	CertFile string
	KeyFile  string
}

TLS holds the certificate file paths

type YamlParser

type YamlParser struct{}

YamlParser is a YAML parser that unmarshals a yaml config file into Reproksie's config

func (*YamlParser) Parse

func (y *YamlParser) Parse(data []byte) (*Config, error)

Parse parses the `yaml` data into a config file

Jump to

Keyboard shortcuts

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