All Projects → root-gg → wsp

root-gg / wsp

Licence: other
HTTP tunnel over Websocket

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to wsp

anytunnel
内网穿透,内网穿透代理服务器,商用内网穿透代理系统,内网穿透平台,内网穿透多用户会员系统。
Stars: ✭ 115 (+35.29%)
Mutual labels:  tunnel, reverse-proxy
Awesome Network Stuff
Resources about network security, including: Proxy/GFW/ReverseProxy/Tunnel/VPN/Tor/I2P, and MiTM/PortKnocking/NetworkSniff/NetworkAnalysis/etc。More than 1700 open source tools for now. Post incoming.
Stars: ✭ 578 (+580%)
Mutual labels:  tunnel, reverse-proxy
Lunnel
fast reverse-proxy
Stars: ✭ 293 (+244.71%)
Mutual labels:  tunnel, reverse-proxy
FastTunnel
expose a local server to the internet. 高性能跨平台的内网穿透解决方案 远程内网计算机 域名访问内网站点 反向代理内网服务 端口转发 http代理
Stars: ✭ 815 (+858.82%)
Mutual labels:  tunnel, reverse-proxy
Sidedoor
SSH connection daemon for Debian/Raspbian/Ubuntu/etc
Stars: ✭ 97 (+14.12%)
Mutual labels:  tunnel, reverse-proxy
Fasttunnel
NAT 内网穿透 远程内网计算机 域名访问内网站点 反向代理内网服务 花生壳 端口转发 http代理 微信 小程序 expose a local server behind a NAT or firewall to the internet like ngrok and frp. NAT ssh proxy tunnel reverse-proxy
Stars: ✭ 248 (+191.76%)
Mutual labels:  tunnel, reverse-proxy
Otunnel
peer-to-peer tunnel tool
Stars: ✭ 224 (+163.53%)
Mutual labels:  tunnel, reverse-proxy
LightTunnel
LightTunnel-内网穿透映射工具,支持TCP、HTTP、HTTPS穿透映射,支持Windows、Linux、Mac、Android系统
Stars: ✭ 40 (-52.94%)
Mutual labels:  tunnel, reverse-proxy
Tcptunnel
将本地内网服务器映射到公网。
Stars: ✭ 72 (-15.29%)
Mutual labels:  tunnel, reverse-proxy
Inlets
Cloud Native Tunnel, now inlets PRO
Stars: ✭ 8,420 (+9805.88%)
Mutual labels:  tunnel, reverse-proxy
tunman
Comprehensive solution for SSH tunnels - respawning, healthchecking/monitoring
Stars: ✭ 43 (-49.41%)
Mutual labels:  tunnel, reverse-proxy
Socket Pipe
Stars: ✭ 132 (+55.29%)
Mutual labels:  tunnel, reverse-proxy
Lanproxy
lanproxy是一个将局域网个人电脑、服务器代理到公网的内网穿透工具,支持tcp流量转发,可支持任何tcp上层协议(访问内网网站、本地支付接口调试、ssh访问、远程桌面、http代理、https代理、socks5代理...)。技术交流QQ群 678776401
Stars: ✭ 4,784 (+5528.24%)
Mutual labels:  tunnel, reverse-proxy
Spike
📣 A fast reverse proxy written in PHP that helps to expose local services to the internet
Stars: ✭ 582 (+584.71%)
Mutual labels:  tunnel, reverse-proxy
Frp
A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Stars: ✭ 51,746 (+60777.65%)
Mutual labels:  tunnel, reverse-proxy
Pyngrok
A Python wrapper for ngrok
Stars: ✭ 159 (+87.06%)
Mutual labels:  tunnel, reverse-proxy
Teleconsole
Command line tool to share your UNIX terminal and forward local TCP ports to people you trust.
Stars: ✭ 2,750 (+3135.29%)
Mutual labels:  tunnel
Ssh-Pascal
Delphi ssh library wrapping libssh2
Stars: ✭ 42 (-50.59%)
Mutual labels:  tunnel
Icmptunnel
Transparently tunnel your IP traffic through ICMP echo and reply packets.
Stars: ✭ 2,753 (+3138.82%)
Mutual labels:  tunnel
purr
Smuggle TCP connections through HTTP
Stars: ✭ 35 (-58.82%)
Mutual labels:  tunnel

WS PROXY

This is a reverse HTTP proxy over websockets. The aim is to securely make call to internal APIs from outside.

How does it works

a WSP client runs in the internal network ( alongside the APIs ) and connects to a remote WSP server with HTTP websockets.

One issue HTTP requests to the WSP server with an extra HTTP header 'X-PROXY-DESTINATION: "http://api.internal/resource"' to the /request endpoint.

The WSP Server then forward the request to the WSP Client over the one of the offered websockets. The WSP Client receive and execute locally an HTTP request to the URL provided in X-PROXY-DESTINATION and forwards the HTTP response back to the WSP server which in turn forwards the response back to the client. Please note that no buffering of any sort occurs.

If several WSP clients connect to a WSP server, requests will be spread in a random way to all the WSP clients.

wsp schema

Get code

go get github.com/root-gg/wsp

WSP server configuration

# wsp_server.cfg
---
host : 127.0.0.1                     # Address to bind the HTTP server
port : 8080                          # Port to bind the HTTP server
timeout : 1000                       # Time to wait before acquiring a WS connection to forward the request (milliseconds)
idletimeout : 60000                  # Time to wait before closing idle connection when there is enough idle connections (milliseconds)
#blacklist :                         # Forbidden destination ( deny nothing if empty )
# - method : ".*"                    #   Applied in order before whitelist
#   url : "^http(s)?://google.*"     #   None must match
#   headers :                        #   Optinal header check
#     X-CUSTOM-HEADER : "^value$"    # 
#whitelist :                         # Allowed destinations  ( allow all if empty )
# - method : "^GET$"                 #   Applied in order after blacklist
#   url : "^http(s)?://.*$"          #   One must match
#   headers :                        #   Optinal header check
#     X-CUSTOM-HEADER : "^value$"    # 
# secretkey : ThisIsASecret          # secret key that must be set in clients configuration
$ cd wsp_server && go build
$ ./wsp_server -config wsp_server.cfg
{
  "Host": "127.0.0.1",
  "Port": 8080
}
2016/11/22 15:31:39 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:31:40 Registering new connection from 7e2d8782-f893-4ff3-7e9d-299b4c0a518a
2016/11/22 15:33:34 GET map[User-Agent:[curl/7.26.0] Accept:[*/*] X-Proxy-Destination:[https://google.fr]]
2016/11/22 15:33:34 proxy request to 7e2d8782-f893-4ff3-7e9d-299b4c0a518a

For now TLS setup should be implemented using an HTTP reverse proxy like NGinx or Apache...

WSP proxy configuration

# wsp_client.cfg
---
targets :                            # Endpoints to connect to
 - ws://127.0.0.1:8080/register      #
poolidlesize : 10                    # Default number of concurrent open (TCP) connections to keep idle per WSP server
poolmaxsize : 100                    # Maximum number of concurrent open (TCP) connections per WSP server
#blacklist :                         # Forbidden destination ( deny nothing if empty )
# - method : ".*"                    #   Applied in order before whitelist
#   url : ".*forbidden.*"            #   None must match
#   headers :                        #   Optinal header check
#     X-CUSTOM-HEADER : "^value$"    # 
#whitelist :                         # Allowed destinations  ( allow all if empty )
# - method : "^GET$"                 #   Applied in order after blacklist
#   url : "http(s)?://.*$"           #   One must match
#   headers :                        #   Optinal header check
#     X-CUSTOM-HEADER : "^value$"    # 
# secretkey : ThisIsASecret          # secret key that must match the value set in servers configuration
  • poolMinSize is the default number of opened TCP/HTTP/WS connections to open per WSP server. If there is a burst of simpultaneous requests the number of open connection will rise and then decrease back to this number.
  • poolMinIdleSize is the number of connection to keep idle, meaning that if there is more than this number of simultaneous requests the WSP client will try to open more connections to keep idle connection.
  • poolMaxSize is the maximum number of simultaneous connection that the proxy will ever initiate per WSP server.
$ cd wsp_client && go build
$ ./wsp_client -config wsp_client.cfg
{
  "ID": "7e2d8782-f893-4ff3-7e9d-299b4c0a518a",
  "Targets": [
    "ws://127.0.0.1:8080/register"
  ],
  "PoolMinSize": 10,
  "PoolMinIdleSize": 5,
  "PoolMaxSize": 100
}
2016/11/22 15:31:39 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:31:40 Connecting to ws://127.0.0.1:8080/register
2016/11/22 15:33:34 got request : {"Method":"GET","URL":"https://google.fr","Header":{"Accept":["*/*"],"User-Agent":["curl/7.26.0"],"X-Proxy-Destination":["https://google.fr"]},"ContentLength":0}

Client

$ curl -H 'X-PROXY-DESTINATION: https://google.fr' http://127.0.0.1:8080/request
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="fr"><head><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" it...
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].