forwardproxy

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

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

Go to latest
Published: Sep 30, 2019 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Secure forward proxy plugin for the Caddy web server fork from https://github.com/caddyserver/forwardproxy

add an extended configure option called upstreamRule. When upstream is set ,upstreamRule will help to make decision wether forward 'direct' or use ''

Configuration extended (add upstreamRule option)

forwardproxy {
    basicauth user1 0NtCL2JPJBgPPMmlPcJ
    ...
    dial_timeout     30
    upstream         https://user:password@extra-upstream-hop.com
    upstreamRule [whitelist|blacklist] [filepath]
}
  • when use 'whitelist', domain in the file will connect directly and the others will forward to upstream
  • when use 'blacklist', domain in the file will forward to upstream and the others will connect directly

Documentation

Overview

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Caching is purposefully ignored.

Index

Constants

This section is empty.

Variables

View Source
var LocalCache = NewCache(5000)

Functions

This section is empty.

Types

type Element

type Element struct {
	// contains filtered or unexported fields
}

Element has key and value

type ForwardProxy

type ForwardProxy struct {
	Next httpserver.Handler
	// contains filtered or unexported fields
}

func (*ForwardProxy) ServeHTTP

func (fp *ForwardProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

type LRU

type LRU struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(size int) *LRU

New returns new LRU cache of the given size

func (*LRU) Get

func (l *LRU) Get(key T) (T, bool)

Get gets a value from the cache

func (*LRU) Set

func (l *LRU) Set(key, val T) bool

Set sets the given key,value pair in the cache. Returns true if new value is set in the cache.

type Map

type Map map[T]*list.Element

type ProxyDesision

type ProxyDesision uint8
const (
	PROXY ProxyDesision = iota
	DIRECT
)

type ProxyError

type ProxyError struct {
	S    string
	Code int
}

func (*ProxyError) Error

func (e *ProxyError) Error() string

func (*ProxyError) SplitCodeError

func (e *ProxyError) SplitCodeError() (int, error)

type ProxyStrategy

type ProxyStrategy uint8
const (
	Whitelist ProxyStrategy = iota
	Blacklist
)

type T

type T interface{}

T is for key, value types

Directories

Path Synopsis
cmd
caddy command
httpclient is used by the upstreaming forwardproxy to establish connections to http(s) upstreams.
httpclient is used by the upstreaming forwardproxy to establish connections to http(s) upstreams.

Jump to

Keyboard shortcuts

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