preface
Some time ago to do a project, because it involves TCP/UDP knowledge more, so simply strike while the iron is hot, write a tool to strengthen the relevant knowledge. In addition, since I am not very good at Golang, I also want to know more about Golang.
Introduction to the
Flynet is a command line tool written in Golang and currently supports the following features:
- Http proxy
- Local Socks5 agent
- The Socks5 proxy in C/S mode supports TCP/UDP
- Intranet through
- . Currently, the project is divided into clien end and Sever end. In addition to HTTP and local SOcks5 agent, other functions need to be used by both ends together.
use
The installation
For Windows and Linux users, download the corresponding version from the Releases page, and download the source code for other platforms.
In Windows, go to the corresponding directory,.\win-client.exe… Or. \ win – server. Exe…
/linux-server… Or. / Linux – client…
Server… Or the client… Said.
If the following information is displayed, the command is successfully executed:
Usage: flynet [options]
-M, --mode choose which mode to run. the mode must be one of['http'.'socks5'.'socks5-tcp'.'socks5-udp'.'forward']
-L, --listen choose which port(s) to listen or forward
-S, --server the server address client connect to
-V, --verbose output detail info
-l, --log output detail info to log file
-H, --help show detail usage
Mail bug reports and suggestions to <[email protected]>
or github: https://github.com/asche910/flynet
Copy the code
Http proxy
HTTP proxy You can run the following command to enable the HTTP proxy function on the local machine. The HTTP proxy function is supported by both client and server.
server -M http -L 8848
Copy the code
or
client -M http -L 8848
Copy the code
The Http proxy service is enabled on port 8848. If no information is displayed, the Http proxy service is successfully started. After all, Linux philosophy is:
No news is good news
Of course, if you still want to see the message, you can add -v or –verbose to the end, which will output a lot of messages. Alternatively, you can add -l or –log to start the log file, which will generate a flynet.log file in the run directory.
Local Socks5 agent
To enable socks5 proxy on this machine, it is also very simple, both client and server support, command as follows:
server -M socks5 -L 8848
Copy the code
or
client -M socks5 -L 8848
Copy the code
This means that socks5 agent is enabled on native port 8848, and Chrome with SwitchyOmega is ready to surf the Web.
Socks5 proxy-TCP in C/S mode
The former is the SOcks5 proxy on the local, and this is the Socks5 proxy with the cooperation of client and server, and the intermediate is transmitted by TCP protocol. Use it freely. The usage method is as follows:
The service side
server -M socks5-tcp -L 8888
Copy the code
The client
client -M socks5-tcp -L 8848 -S asche.top:8888
Copy the code
In this example, we assume that the domain name of the server is ASche.top, and the client starts socks5 proxy on port 8848. Then the traffic is forwarded to port 8888 of the server through TCP, and the server requests the corresponding target website, and then returns the request result to the client. If possible, the intermediate traffic is encrypted to ensure transmission security.
Socks5 proxy in C/S mode -UDP
This is very similar to the TCP one above, except that this one uses UDP packets for transmission. After all, UDP has its advantages in some respects, and some important protocols, such as DNS, use UDP for transport. Here’s how to use it:
The service side
server -M socks5-udp -L 53
Copy the code
The client
client -M socks5-udp -L 8848 -S asche.top:53
Copy the code
In this example, the domain name asche.top and port 53 are used as examples. The client enables the Socks5 proxy on port 8848. Then, all traffic is transmitted to port 53 on the server in UDP mode. Likewise, intermediate transmissions are encrypted.
Intranet through
Intranet penetration, namely, NAT penetration, is a term used for network connection. When the computer is in a LAN, the computer nodes on the Internet and Intranet need to be connected for communication, and sometimes Intranet penetration is not supported. That is to say, mapping ports allows computers on the external network to find computers on the internal network, improving download speed
Simply put, it means that the Internet can access the machines on the Intranet. The tool maps a port on the Intranet to a port on the server. In this way, you can access the port on the Intranet indirectly by accessing a port on the server. The method is as follows:
The service side
server -M forward -L 8888 8080
Copy the code
The client
server -M forward -L 80 -S asche.top:8888
Copy the code
In this case, port 80 of the client is mapped to port 8080 of the server. In the middle, the server listens on port 8888 to complete data transmission. Then we go to Asche.top :8080 and see what should be on the client port 80.
conclusion
The project currently has limited functions, but more functions will be added in the future. In addition, the address is located in Flynet, but also hope you support!