gsproxy

package module
v0.0.0-...-8fe91a7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

README

gsproxy is a simple http proxy with basic authentication support.

Installing from source

To install, run

$ go install github.com/yangxikun/gsproxy/cmd/gsproxy@latest 

You will now find a gsproxy binary in your $GOPATH/bin directory.

Usage

Start proxy

$ gsproxy --credentials test1:1234,test2:5678

Run gsproxy -help for more information:

Usage of gsproxy:
  --black_domains_file string      list of domains that do not want to be proxied
  --credentials string             basic credentials: username1:password1,username2:password2
  --expose_metrics_listen string   expose metrics listen addr
  --gen_credential                 generate a credential for auth
  --listen string                  proxy listen addr (default ":8080")
  --log_color                      enable log color

Config by environment variable:

GSPROXY_LISTEN=:9898
GSPROXY_EXPOSE_METRICS_LISTEN=:9090
GSPROXY_CREDENTIALS=test1:1234,test2:5678
GSPROXY_GEN_CREDENTIAL=true

Config by yaml file:

listen: :8181
expose_metrics_listen: :8282
credentials:
  - aaa:bbb
  - ccc:ddd
gen_credential: false

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLog

func InitLog(enableColor bool)

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

RandStringBytesMaskImprSrc generate fixed length random string from http://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-golang

Types

type BadRequestError

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

BadRequestError 非法的请求

func (*BadRequestError) Error

func (b *BadRequestError) Error() string

type Server

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

Server 代理服务

func NewServer

func NewServer(addr, exposeMetricsAddr string, credentials []string, genCredential bool, blackDomains []string) *Server

NewServer create a proxy server

func (*Server) Start

func (s *Server) Start()

Start a proxy server

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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