An implementation of LCX (HTRAN) under Golang
By proactively connecting to a computer with a public IP address to open a tunnel, the Intranet can be penetrated so that the services provided by Intranet hosts can be accessed by external hosts. Software implemented port forwarding, transparent proxy, can bypass the firewall when the host limits inbound rules but does not limit outbound rules.
build
go build nb.go
If no message is displayed, the compilation succeeds. (Linux philosophy: No news is the best news)
Run the./nb command in the current directory for Linux or Mac OS, and run nb.exe in the current directory for Windows. If the welcome message is displayed, everything is normal.
If there is a compilation error, please check whether golang on the current system is broken. It is recommended to try again after reinstallation or directly download the compiled binary file. See below for the download address.
If an error occurs, check whether the parameters you entered are incorrect or the corresponding port is occupied. Change the port and try again. If you do not see the welcome message, set permission to 777 for the compiled executable file. If logs cannot be written, check whether the current user has the read and write permission on the log file path.
Github.com/cw1997/NATB…
– V1.0.0 release date: 2017-10-20 16:11:02 Platform: Windows-386, Windows-AMD64 download address
platform
- Windows 7 7601 + GO1.7.5 (Windows/AMD64) Compiled and tested successfully
- Ubuntu 16.04.1 + go1.6.2(Linux /amd64) compiled and tested successfully
- Windows 2003 SP2 3790 + GO1.9.1 (Windows /386) compiled and tested successfully
grammar
- -listen port1 port2
Port1 and Port2 are monitored at the same time. When two clients actively connect to these two monitoring ports, NB is responsible for data forwarding between the two ports.
The sample
nb -listen 1997 2017
- -tran port1 ip:port2
instructions
The local starts listening on port1. When port1 receives an active connection from the client, NB actively connects to IP :port2 and forwards data between port1 and IP :port2.
Nb - tran 192.168.1.2 instead of 1997:338
grammar
- -slave ip1:port1 ip2:port2
The local network proactively connects to ip1:port1 and IP2 :port2 hosts. After the connection is successful, NB forwards data between the two hosts.
The sample
Nb - slave 127.0.0.1:3389 8.8.8.8:1997
- log filedirpath
The sample
nb -listen 1997 2017 -log D:/nb
Nb-tran 1997 192.168.1.2:338-log D:/ NB
Nb-slave 127.0.0.1:3389 8.8.8.8:1997 -log D:/nb
-log is an optional switch. The parameter is the directory where log files reside. If this switch is added to the end of any of the previous mandatory switches, all forward data will be recorded in the D:/ NB/y_M_D_H_I_S-AGrs1-args2-args3.log file, where YmdHis and args will be replaced by the actual execution time and parameters. If you have special requirements, you can merge the logs according to the time sequence and related parameters to obtain continuous forwarding data logs. (Because the forwarded data may not be text files, it is recommended to use UltraEdit and other binary viewing editors to open it.)
Warning: Do not use file paths that contain Spaces and special characters, such as C:\Documents and Settings\Administrator\ desktop \go\bin. This file path is invalid because it contains Spaces.
Note: Since log stream recording is real-time, it is recommended to store log files on a mechanical hard disk partition rather than on devices such as SOLID-state drives, USB drives, SD cards, etc., to prevent large numbers of small file writes from affecting the life of these devices.
Tip: Use the tail -f command in Linux to display the forwarding data in real time.
TODO
- UDP forwarding support