talon_access_proxy

package module
v0.0.0-...-b003ea2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: MIT Imports: 19 Imported by: 0

README

talon-access-proxy

This is a standalone http proxy that caches connections to a server.

It is used for talon.one as a middleware to reduce latency to the talon.one api endpoint.

Installation

You find releases in Github Releases section.

Or you can use go install:

go install github.com/talon-one/talon-access-proxy/cmd/talon-access-proxy

Usage

# talon-access-proxy --help

talon-access-proxy is a proxy for the talon service api

Usage:

    talon-access-proxy [option]

The options are:

    -h, --help         show this help
    -c, --config       specify the config file to use
    -p, --port         specify a port to listen on
    -a, --address      listen on this address (host:port), overrides --port
    -r, --root=/       specify a root path for this service
    -t, --talon=       specify the talon api url to use
    -v, --version      show the version

Environment settings:

You can set various environment variables in conjunction with the options, note that
options overwrite the corresponding environment variable.

    APP_CONFIG         specify the config file to use
    PORT               specify a port to listen on
    APP_PORT
    HTTP_PLATFORM_PORT
    ASPNETCORE_PORT
    ADDRESS            listen on this address (host:port), overrides PORT
    APP_ADDRESS
    APP_ROOT           specify a root path for this service

The config

The config specified with --config or APP_CONFIG can also be used to specify options

Sample Config:
[
    {
        // Address to listen on
        "Address": "127.0.0.1:8000"

        // Root path
        "Root": "/"

        // Talon api
        "TalonAPI": "https://demo.talon.one"

        // DNS Server that should be used for lookups
        "DNSServer": "8.8.8.8:53"

        // How many concurrent connections should be used
        "MaxConnections": 100
        

        // Application specific settings
        Application: {
            // Application with the ID 1
            "1": {
                // Calculate HMAC for each request
                "CalculateHMAC": false

                // Application Key (required for CalculateHMAC)
                ApplicationKey: "deadbeef"
            }
        }
    },
    {
        // Open a second instance
        "Address": "127.0.0.1:8001"
        "TalonAPI": "https://demo.talon.one"
    },
]

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildDate = "Unknown/CustomBuild"

BuildDate represents the build date of talon-access-proxy

View Source
var Version = "Unknown/CustomBuild"

Version represents the build version of talon-access-proxy

View Source
var VersionHash = "Unknown/CustomBuild"

VersionHash represents the git sha1 which this version was built on

Functions

This section is empty.

Types

type ApplicationConfig

type ApplicationConfig struct {
	// Calculate HMAC
	CalculateHMAC bool
	// Application Key
	ApplicationKey string

	// ApplicationToken to use
	ApplicationToken string
	// contains filtered or unexported fields
}

type Config

type Config struct {
	// TalonAPI is the URL to use
	TalonAPI string

	// DNSServer to use for dns lookups (Default is 8.8.8.8:53)
	DNSServer string
	// MaxConnections to use
	MaxConnections int

	// Application ID
	Application map[string]*ApplicationConfig

	// Logger to write data to
	Logger *zap.Logger
	// contains filtered or unexported fields
}

Config contains settings for the proxy

func (*Config) SetDefaults

func (config *Config) SetDefaults() error

SetDefaults validates and sets defaults for Config

type Tap

type Tap struct {
	Config Config
	// contains filtered or unexported fields
}

Tap implements the talon-access-proxy functionality

func New

func New(config Config) (*Tap, error)

New creates a new instance of the Tap type

func (*Tap) Close

func (t *Tap) Close()

Close the tap instance

func (*Tap) Handler

func (t *Tap) Handler() http.Handler

Handler returns an http.Handler instance

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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