https://github.com/codeskyblue/proxylocal
Proxy local server to public network. (include server and client)
https://github.com/codeskyblue/proxylocal
Last synced: about 1 year ago
JSON representation
Proxy local server to public network. (include server and client)
- Host: GitHub
- URL: https://github.com/codeskyblue/proxylocal
- Owner: codeskyblue
- License: mit
- Created: 2015-08-28T11:21:05.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-11-10T07:03:32.000Z (over 9 years ago)
- Last Synced: 2025-03-25T14:44:48.505Z (about 1 year ago)
- Language: Go
- Homepage:
- Size: 246 KB
- Stars: 15
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# proxylocal
[](https://travis-ci.org/codeskyblue/proxylocal)
[](https://godoc.org/github.com/codeskyblue/proxylocal/pxlocal)
Proxy local service to public.
> I want to expose a local server behide a NAT or firewall to the internet.
There are some similar service.
* Write in nodejs. Very good one.
* Write in python.
* Blocked by GFW.
* Need pay price to get service.
* Server seems down. Use ngrok, VPS in china.
Binary can be download from [gorelease](http://gorelease.herokuapp.com/codeskyblue/proxylocal)
Very suggest to compile use `go1.4`. I donot know why, but use `go1.5`, the proxylocal got a very very bad performance.
At the beginning this is just for study how to proxy local server to public network. Now it can be stable use.
这个东西目前看来确实是个很不错的东西,可以调试微信,可以把自家路由器的东西放到外网。还可以通过它的tcp转发功能,远程调试家中的树莓派。用途多多
不过服务器最好自己搭. 如果希望贡献出来你的server可以发起个Issue.
## Installation
```
go get -v github.com/codeskyblue/proxylocal
```
## Usage
Run server in a public network, listen in port 8080 (Assuming your ip is 122.2.2.1)
proxylocal --listen 8080
Assume you are running your local tcp-server on port 5037. To make it publicly available run:
proxylocal --server 122.2.2.1:8080 --proto tcp 5037
If this is a web server, only need to update `--proto`
proxylocal --server 122.2.2.1:8080 --proto http 5037
# expects output
proxy URL: http://localhost:5037
Recv Message: Local server is now publicly available via:
http://wn8yn.t.localhost
## Hooks
The functions of hooks are limited.
The hook system is very familar with git hook. When a new proxy request comes to the server. Server will execute some script.
Now I put all the hook script in hooks dir.
There are examples you found in [hooks](hooks)
## Use as a library
```go
package main
import "github.com/codeskyblue/proxylocal/pxlocal"
func main(){
client := pxlocal.NewClient("10.0.1.1:4000")
px, err := client.StartProxy(pxlocal.ProxyOptions{
Proto: pxlocal.TCP,
LocalAddr: "192.168.0.1:7000",
ListenPort: 40000, // public port
})
if err != nil {
log.Fatal(err)
}
// px.RemoteAddr()
err = px.Wait()
log.Fatal(err)
}
```
### Environment
Server address default from env-var `PXL_SERVER_ADDR`
## LICENSE
[MIT LICENSE](LICENSE)