opennotr
opennotr is a nat tranversal application base on a VPN tunnel and openresty.
opennotr provides http, https, grpc, tcp and udp nat traversal. For http, https, grpc, opennotr supports multi client share the 80/443 ports, it maybe useful for wechat, facebook webhook debug.
Status: Alpha
The technical architecture of opennotr
Table of Contents
Features
opennotr provides these features:
- Supports multi protocol, http, https, grpc, tcp, udp.
- Multi client shares the same http, https, grpc port, for example: client A use
a.notr.tech
domain, client B useb.notr.tech
, they can both use 80 port for http. Opennotr use openresty for dynamic upstream. - Dynamic dns support, opennotr use coredns and etcd for dynamic dns.
- Support stream proxy plugin
Build
Build binary:
./build_exec.sh
The binary file will created in bin folder.
Build docker image:
./build_image.sh
This scripts will run build_exec.sh
and build an image name opennotr
Install
Install via docker-compose
- create configuration file
mkdir /opt/data/opennotrd
An example of configuration folder tree is:
root@iZwz97kfjnf78copv1ae65Z:/opt/data/opennotrd# tree
.
|-- cert ---------------------> cert folder
| |-- upstream.crt
| `-- upstream.key
`-- notrd.yaml ---------------> opennotr config file
2 directories, 5 files
the cert folder MUST be created and the crt and key file MUST created too.
root@iZwz97kfjnf78copv1ae65Z:/opt/data/opennotrd# cat notrd.yaml
server:
listen: ":10100"
authKey: "client server exchange key"
domain: "open.notr.tech"
dhcp:
cidr: "100.64.242.1/24"
ip: "100.64.242.1"
upstream:
remoteAddr: "http://127.0.0.1:81/upstreams"
the only one configuration item you should change is domain: "open.notr.tech"
, replace open.notr.tech
with your own domain.
- Run with docker
docker run --privileged --net=host -v /opt/logs/opennotr:/opt/resty-upstream/logs -v /opt/data/opennotrd:/opt/conf -d opennotr
Or use docker-compose
wget https://github.com/ICKelin/opennotr/blob/develop/docker-build/docker-compose.yaml
docker-compose up -d opennotrd
Plugin
opennotr provide plugin interface for developer, Yes, tcp and udp are buildin plugins.
For a new plugin, you should implement the Proxier interface which contains RunProxy method.
type Proxier interface {
RunProxy(item *ProxyItem) error
}
And then import the plugin pakcage in main.go
import _ "path to you plugin package"
Technology details
Author
A programer name ICKelin.