Skip to content
/ gogw Public

A fast port forwarding or reverse forwarding tool over HTTP1.0/HTTP1.1

Notifications You must be signed in to change notification settings

xitongsys/gogw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gogw

What's gogw ?

gogw is a port forwarding/reverse forwarding tool over HTTP implements by golang.

  • port forwarding/port reverse forwarding
  • support TCP/UDP
  • pure over HTTP1.0/HTTP1.1(no WebSocket) to avoid some firewall issues

How to use ?

Expose any service(TCP/UDP) behind a NAT or firewall to the internet

Suppose you have a host with public IP 11.11.11.11 and local host behind a firewall. You run a webservice on your local host port 80 and want others to access it.

  1. Edit the config file for gogw server
{
	"Server":{
		"ServerAddr":"0.0.0.0:80",
		"TimeoutSecond": 30
	}
}
  1. Run gogw server on your public host.
./gogw -c config.json -r server 
  1. Edit the config file for your local host to run gogw client.
{
	"Clients":[{
		"ServerAddr":"11.11.11.11:80",
		"SourceAddr":"127.0.0.1:80",
		"ToPort":81,
		"Protocol": "tcp",
		"Direction": "reverse",
		"Description":"webservice",
		"Compress": true,
		"HttpVersion": "http1.1"
	}]
}
  1. Run gogw client on your local host.
./gogw -c config.json -r client

Now your can access your web service through https://11.11.11.11:81

Listen local port and forward packets to remote server as a proxy

Suppose you have a local host A(10.0.0.2), local host B(10.0.0.3) and another host C(11.11.11.11) runing a web server on port 8080. You want the host B access C web server through A.

  1. Edit config.json for gogw server and client.
{
	"Server":{
		"ServerAddr":"0.0.0.0:80",
		"TimeoutSecond": 30
	},
	"Clients":[{
		"ServerAddr":"127.0.0.1:80",
		"SourceAddr":"11.11.11.11:80",
		"ToPort":81,
		"Protocol": "tcp",
		"Direction": "forward",
		"Description":"webservice",
		"Compress": true,
		"HttpVersion": "http1.1"
	}]
}
  1. Run gogw server and client on host A
# run server
./gogw -c config.json -r server

# run client
./gogw -c config.json -r client

Now host B can access host C web servie through https://10.0.0.2:81

Web ui

It has a simple web ui on gogw server. https://server_ip:server_port/ui ui

Status

Some functions or code improvements can be added:

  • authentication/encryption
  • more powerfull ui and monitor
  • unit test
  • ...

Any contribution is welcome even just a star :)

About

A fast port forwarding or reverse forwarding tool over HTTP1.0/HTTP1.1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published