All Projects → panjf2000 → Goproxy

panjf2000 / Goproxy

Licence: gpl-3.0
🦁 goproxy is a proxy server which can forward http or https requests to remote servers./ goproxy 是一个反向代理服务器,支持转发 http/https 请求。

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Goproxy

Proxyman
Modern and Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
Stars: ✭ 2,571 (+1369.14%)
Mutual labels:  proxy, proxy-server
Eagle.tunnel.dotnet.core
稳定易用的代理工具
Stars: ✭ 168 (-4%)
Mutual labels:  proxy, proxy-server
Testcafe Hammerhead
A powerful web-proxy used as a core for the TestCafe testing framework. 🔨 😃
Stars: ✭ 119 (-32%)
Mutual labels:  proxy, proxy-server
Forward Proxy
150 LOC Ruby forward proxy using only standard libraries.
Stars: ✭ 105 (-40%)
Mutual labels:  proxy, proxy-server
Beyond
BeyondCorp-inspired Access Proxy. Secure internal services outside your VPN/perimeter network during a zero-trust transition.
Stars: ✭ 151 (-13.71%)
Mutual labels:  proxy, proxy-server
Freeproxy
免费、高速的 V2Ray 代理和订阅。
Stars: ✭ 104 (-40.57%)
Mutual labels:  proxy, proxy-server
3proxy
3proxy - tiny free proxy server
Stars: ✭ 2,263 (+1193.14%)
Mutual labels:  proxy, proxy-server
Tor Router
A SOCKS, HTTP and DNS proxy for distributing traffic across multiple instances of Tor
Stars: ✭ 69 (-60.57%)
Mutual labels:  proxy, proxy-server
Mockingbird
Simplify software testing, by easily mocking any system using HTTP/HTTPS, allowing a team to test and develop against a service that is not complete or is unstable or just to reproduce planned/edge cases.
Stars: ✭ 149 (-14.86%)
Mutual labels:  proxy, proxy-server
Shadowsocks Cloak Installer
A one-key script to setup Cloak plugin with Shadowsocks on your server
Stars: ✭ 138 (-21.14%)
Mutual labels:  proxy, proxy-server
Proxy
C++ TCP Proxy Server
Stars: ✭ 98 (-44%)
Mutual labels:  proxy, proxy-server
Psiphon
A multi-functional version of a popular network circumvention tool
Stars: ✭ 169 (-3.43%)
Mutual labels:  proxy, proxy-server
Delete
(迫于压力,本项目停止维护,请尽快fork代码。1月1日之后删除项目)[免翻墙工具]A free and open-source youtube video proxy script [Written in PHP]
Stars: ✭ 1,316 (+652%)
Mutual labels:  proxy, proxy-server
Httpproxy
Go HTTP proxy server library
Stars: ✭ 110 (-37.14%)
Mutual labels:  proxy, proxy-server
Lightsocks Nodejs
It's a simple socks5 proxy tool which based on lightsocks
Stars: ✭ 79 (-54.86%)
Mutual labels:  proxy, proxy-server
Gobetween
☁️ Modern & minimalistic load balancer for the Сloud era
Stars: ✭ 1,631 (+832%)
Mutual labels:  proxy, proxy-server
Imager
Image processing proxy
Stars: ✭ 56 (-68%)
Mutual labels:  proxy, proxy-server
Proxy List
A list of free, public, forward proxy servers. UPDATED DAILY!
Stars: ✭ 1,125 (+542.86%)
Mutual labels:  proxy, proxy-server
Flynet
A powerful TCP/UDP tool, which support socks5 proxy by tcp and udp, http proxy and NAT traversal. This tool can help you bypass gfw easily
Stars: ✭ 124 (-29.14%)
Mutual labels:  proxy, proxy-server
Free Email Forwarding
The best free email forwarding for custom domains. Visit our website to get started (SMTP server)
Stars: ✭ 2,024 (+1056.57%)
Mutual labels:  proxy, proxy-server

Build Status Goproxy on Sourcegraph GPL Licence Open Source Love

Engilish|🇨🇳中文

goproxy

goproxy is a load-balancing, reverse-proxy server implemented in go, supporting cache( in memory or Redis). As a load-balancing server, it supports 4 algorithms: Randomized Algorithm, Weight Round Robin Algorithm, Power of Two Choices (P2C) Algorithm, IP Hash Algorithm, Consistent Hashing with Bounded Loads Algorithm, besides, goproxy can dominate the http requests: filtering and blocking specific requests and even rewriting them.

Sometimes your program needs to call some third party API and wants to customize the responses from it, in that case, goproxy will be your great choice.

🚀 Features:

  • Supporting reverse-proxy, 6 load-balancing algorithms in goproxy: Random, IP Hash, Round Robin, Weight Round Robin, Power of Two Choices (P2C), Consistent Hashing with Bounded Loads
  • Supporting GET/POST/PUT/DELETE Methods in http and CONNECT method in https in goproxy
  • Supporting HTTP authentication
  • Filtering and blocking specific http requests and even rewriting them in goproxy
  • Customizing responses from third-party API
  • Cache support with memory or Redis to speed up the responding and the expired time of caches is configurable
  • Flexible and eager-loading configurations

🎉 How to use goproxy

1.Get source code

go get github.com/panjf2000/goproxy

Besides, you also need a Redis to support caching responses if you enable Redis config in goproxy.

2.Compile the source code

cd $GOPATH/src/github.com/panjf2000/goproxy

go build

3.Run

goproxy uses cfg.toml as its configurations file which is located in /etc/proxy/cfg.toml of your server, you should create a cfg.toml in there previously, here is a typical example:

# toml file for goproxy

title = "TOML config for goproxy"

[server]
port = ":8080"
reverse = true
proxy_pass = ["127.0.0.1:6000"]
# 0 - random, 1 - loop, 2 - power of two choices(p2c), 3 - hash, 4 - consistent hashing
inverse_mode = 2
auth = false
cache = true
cache_timeout = 60
cache_type = "redis"
log = 1
log_path = "./logs"
user = { agent = "proxy" }
http_read_timeout = 10
http_write_timeout = 10

[redis]
redis_host = "localhost:6379"
redis_pass = ""
max_idle = 5
idle_timeout = 10
max_active = 10

[mem]
capacity = 1000
cache_replacement_policy = "LRU"

Configurations:

[server]

  • port:the port goroxy will listen to
  • reverse:enable the reverse-proxy feature or not
  • proxy_pass:back-end servers that actually provide services, like ["127.0.0.1:80^10","127.0.0.1:88^5","127.0.0.1:8088^2","127.0.0.1:8888"], weight can be assigned to every single server
  • inverse_mode:load-balancing algoritms:0 for Randomized Algorithm; 1 for Weight Round Robin Algorithm; 2 for Power of Two Choices (P2C) Algorithm; 3 for IP Hash Algorithm based on hash ring; 4 for Consistent Hashing with Bounded Loads Algorithm
  • auth:enable http authentication or not
  • cache:enable responses caching or not
  • cache_timeout:expired time of responses caching, in seconds
  • cache_type: redis or memory
  • log:log level, 1 for Debug,0 for info
  • log_path:the path of log files
  • user:user name from http authentication
  • http_read_timeout:duration for waiting response from the back-end server, if goproxy don't get the response after this duration, it will throw an exception
  • http_write_timeout:duration for back-end server writing response to goproxy, if back-end server takes a longer time than this duration to write its response into goproxy, goproxy will throw an exception

[redis]

  • redis_host:redis host
  • redis_pass:redis password
  • max_idle:the maximum idle connections of redis connection pool
  • idle_timeout:duration for idle redis connection to close
  • max_active:maximum size of redis connection pool

[mem]

  • capacity: cache capacity of items
  • cache_replacement_policy: LRU or LFU

There should be a binary named goproxy as the same of project name after executing the go build command and that binary can be run directly to start a goproxy server.

The running goproxy server listens in the port set in cfg.toml and it will forward your http requests to the back-end servers set in cfg.toml by going through that port in goproxy.

🎱 Secondary development

Up to present, goproxy has implemented all basic functionalities like reverse-proxy, load-blancing, http caching, http requests controlling, etc and if you want to customize the responses more accurately, you can implement a new handler by inheriting (not a strict statement as there is no OO in golang) from the ProxyServer struct located in handlers/proxy.go and overriding its method named ServeHTTP, then you are allowed to write your own logic into it.

🙏🏻 Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].