Using gost to Build Your Own Proxy Server and Forwarding Proxy Chains
本文最后更新于 316 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。
Article Abstract
Addressing the issues of complex setup and insufficient authentication support in traditional proxy servers, gost supports multi-protocol proxy services such as HTTP, HTTPS, and SOCKS5 through single-command deployment, and achieves flexible proxy chain construction in combination with the -F parameter. Its forwarding function can bypass self-signed certificate restrictions and is compatible with clients that do not support authentication. The proxy chain mode enhances anonymity and access stability through multi-node series connection, which is especially suitable for cross-border network acceleration scenarios. In actual deployment, combining gost with tools like tailscale can achieve efficient proxy chain configuration under encrypted networking, significantly reducing operation and maintenance complexity.
Qwen3-14B · 2026-06-18

Preface

I still remember how I used to spend ages searching and researching online just to run a simple, standard proxy server feature on macOS, Windows, and Debian (mainly to support username and password authentication). On Windows, I even used a cracked version of CCProxy for a long time (to be fair, it was actually usable). Later, I discovered GOST. Holy crap, setting up a proxy server for various protocols takes just one simple command. It also supports multiple platforms, allowing for unified deployment across all platforms. Crucially, it also flexibly supports proxy chains and various other extended features—it's just too awesome. This article mainly introduces GOST's most basic features of setting up a proxy server and building forwarding proxy chains.

Deploy gost

Deploy the latest version in the standard way

Linux

The command is as follows:

wget -O - https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-linux-amd64-2.11.5.gz | gzip -d > /usr/bin/gost
chmod +x /usr/bin/gost

If you want to set gost to start automatically on boot, the recommended way is to register gost as a system service. You can refer to my other article:Debian Series: 3 Common Ways to Set Commands or Scripts to Run at Startup。

Windows

You need to download the package for the corresponding architecture first:
amd64:https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-windows-amd64-2.11.5.zip
arm :https://github.com/ginuerzh/gost/releases/download/v2.11.5/gost-windows-arm64-2.11.5.zip
Extract the exe executable file in the zip package (for example, the arm version is gost-windows-arm64.exe) to your preferred path (such as the c:/gost directory), rename the file to gost.exe, and then run itcmdcommand to enter the terminal and use the commandcd c:/gostEnter the gost directory, and finally run the gost format command directly.

Windows also has a GUI usage method, see the next section.

Desktop GUI method

If you are using a desktop system (macos, windows, linux desktop), there is actually another option: gost-ui-3, the project address is as follows:https://github.com/yarnto/gost-ui-3This project simply packages gost into an app, which can be installed and run directly. Crucially, you can intuitively see the deployed content:

mac_1710298158578.png

You can download and install the corresponding version according to your respective environment.
Win version download link:
https://github.com/yarnto/gost-ui-3/releases/download/3.0.0-20220515/gost-ui-3-win-amd64.Setup.3.0.0.exe
Linux version download link:
https://github.com/yarnto/gost-ui-3/releases/download/3.0.0-20220515/gostui3-linux-amd64.zip
macOS version download link:
https://github.com/yarnto/gost-ui-3/releases/download/3.0.0-20220608/gostui3.app-darwin-20220608.zip

gost simple tutorial

Why is it called a simple tutorial? Because gost is so powerful, I don't even know where to start:

image.png

Actually, if you have some basic knowledge, I highly recommend you directly read the official website tutorial:https://v2.gost.run/, which is already written in great detail. Here, I can only give a brief introduction to the functions and related commands for setting up proxy servers and building forwarding proxy chains, which I think you are most likely to encounter.

Proxy server (-L parameter)

The proxy server function provided by gost supports many protocols:

image.png

The four protocols we use most commonly are http, https, socks5, and shadowsocks. Let's take deploying proxy servers for these four protocols as an example.

Enable a local http proxy server on port 8080:

gost -L http://:8080 #在本地8080端口启用不需要用户名密码认证的http代理服务
gost -L http://192.168.0.1:8080 # 限定http代理只在本地192.168.0.1这个地址的8080端口
gost -L http://guest:guest@:8080 #访问http代理需要账号密码认证,这里的账号密码均为guest

Enable a local https proxy server on port 8443:

gost -L http+tls://:8443 #在本地8443端口启用不需要用户名密码认证的https代理服务
gost -L http+tls://192.168.0.1:8443 # 限定https代理只在本地192.168.0.1这个地址的8443端口上
gost -L http+tls://guest:guest@:8443 #访问https代理需要账号密码认证,这里的账号密码均为guest

Enable a local socks5 proxy server on port 1080:

gost -L socks5://:1080 #在本地1080端口启用不需要用户名密码认证的socks5代理服务
gost -L socks5://192.168.0.1:1080 #限定socks5代理只在本地192.168.0.1这个地址的1080端口上
gost -L socks5://guest:guest@:1080 #socks5代理需要账号密码认证,这里的账号密码均为guest
gost -L socks5+tls://:1080  #对socks5使用tls加密
gost -L socks5+tls://guest:guest@:1080 #对socks5使用tls加密并启用账号认证
gost -L socks5+quic://:1080 #socks5 over quic

Enable a local ss proxy server on port 8338:

gost -L ss://aes-256-gcm:guest@:8338 #使用aes-256-gcm加密算法,密码为guest的方式在8338端口启用ss代理服务
gost -L ss://aes-256-gcm:[email protected]:8338 #使用aes-256-gcm加密算法,密码为guest的方式在本地的192.168.0.1这个地址的8338端口启用ss代理服务
gost -L ss+tls://aes-256-gcm:guest@:8338 #使用aes-256-gcm加密算法,密码为guest的方式在8338端口启用ss+tls加密的代理服务

By default, the shadowsocks protocol will wait for request data. When the request data is received, it will send the protocol header information together with the request data to the server. When the client'snodelayoption is set totrue, the protocol header information will be sent to the server immediately, no longer waiting for the user's request data. When the server connected through the proxy actively sends data to the client (such as VNC service, MySQL database), this option needs to be enabled to avoid connection anomalies. Here is an example of client configuration:

gost -L=:8080 -F ss://aes-256-gcm:[email protected]:8338?nodelay=true

If tls is used for encryption, whether it is http, socks5 or other protocol proxies, a certificate issue is involved. By default, gost will use a self-signed certificate. If the client is also gost, there will be no problem. However, if the client is something else (such as smartproxy in Chrome browser), it will verify the validity of the certificate, which will cause problems. Therefore, if the deployed server needs to face clients other than gost, a valid custom certificate needs to be deployed. There are 2 ways to deploy custom certificates:
Place the certificate and private key directly in the gost installation directory
Just place the two files cert.pem (public key) and key.pem (private key) in the gost running directory (they must be named this way), and GOST will automatically load the cert.pem and key.pem files in the running directory.
Specify the certificate path using the cert and key parameters in the running command
The advantage of this method is that different certificates can be deployed for multiple domain names, as shown in the following example:

gost -L="tls://:443?cert=/path/to/my/cert/file&key=/path/to/my/key/file"

**Item 9:**
If it is for intranet use, direct http or socks5 is sufficient
If the traffic goes across the public network, it is highly recommended to add tls, safety first. At the same time, http+tls can also be written directly as https. I wrote it this way just to keep it consistent with socks5+tls and ss+tls below, OCD users please understand.
-L defaults to HTTP & SOCKS5, which actually means-L http://:8080 和 -L socks5://:1080can be written directly as-L :8080和-L :1080The effect is the same, but for the convenience of future operation and maintenance, it is still recommended to write it in full.
http2 is compatible with https, which means that forhttp2://type proxies, clients that support https proxies can use them directly (of course, certificate issues still need to be considered)
gost only supports the HTTP2 protocol encrypted with TLS, and does not support plaintext HTTP2 transmission
gost's proxy chain only supports one HTTP2 proxy node. Adopting the proximity principle, the first HTTP2 proxy node encountered will be treated as an HTTP2 proxy, and other HTTP2 proxy nodes will be treated as HTTP proxies.
The shadowsocks protocol now has a very high recognition rate. You may consider replacing it, or try to use it in conjunction with other tunnel protocols or transport encryption protocols.


Forwarding service (-F parameter)

As mentioned above, gost's self-signed certificates are not recognized by most other clients except gost, and many clients do not support authentication:

image.png

Whether intentional or not, the current reality is that for those using Chrome's smartproxy plugin, neither https nor socks5 supports authentication. I can't possibly put a proxy server that supports encryption on the public network and let it become an anonymous proxy just because the accessing client doesn't support account authentication. I wouldn't dare do such a thing even if it killed me. So what should we do? This is where gost's forwarding function (-F parameter) comes into play. Run either of the following 2 commands on the client's local host (assuming both the client and server are on the intranet):

gost -L http://:8080 -F https://guest:[email protected]:8443
gost -L http://:8080 -F socks5://guest:[email protected]:1080

This command will open an http proxy service on port 8080 on the client host locally, and point the upstream proxy to the host where the server gost is located, while authenticating using the username and password specified by gost on the server. The client's browser only needs to point the http proxy directly to the http proxy server running on the local port 8080. Of course, in a normal usage environment, the client is definitely on the external network, so it needs to connect using the server's public IP or the domain name corresponding to the public IP.

This approach has the following advantages:
Solved the problem of gost server's tls self-signed certificate
Solved the problem that client browser plugins may not support authentication

Forwarding proxy chain (multiple -F parameters)

Introduction to proxy chain concepts

What is a proxy chain?

image.png

As shown in the figure above, a proxy chain refers to a chain structure formed by connecting multiple proxy servers in some way (such as the series connection in the figure above) between the user request and the target website. When a user initiates a request, the request will be forwarded through each proxy server to the next node in the set manner (for example, the series connection in the figure above passes through each proxy server on this proxy chain in turn), and finally reaches the target server.

Note: These proxy servers can be of different types, for example, proxy 1 is http, proxy 2 is socks5, and proxy 3 is socks4

Advantages of proxy chains:
Anonymity and security
Proxy chains can enhance the anonymity and security of user access, because each proxy server hides the real IP address for the user (so why is it hard to find the real address of hackers after they break in?).
Fixed IP for accessing websites
Proxy chains allow users to fix their access IP. You only need to specify a suitable proxy server at the last hop of the proxy chain, and then as long as you keep using this server, you can always use this IP to access the target website, avoiding issues such as website account risk control caused by IP switching and poor IP quality.

Disadvantages of proxy chains:
Problems brought by multiple nodes
It may cause network performance issues such as latency and bandwidth, and the stability also depends on the overall condition of all nodes.
Security
Proxy forwarding will improve security to some extent, but security depends on the weakest link, and it does not mean that a longer proxy chain is safer. If you need anonymity, please consider mature anonymity solutions.

Proxy chain principle

You may not necessarily be interested in this question, but out of interest, I searched for a long time and found the following two pictures for comparison.
The ”proxy-to-proxy” method without a proxy chain

image.png

This should be the traditional way of pointing to an upstream proxy on the proxy server software. This method requires each level of proxy to resend the request as a client, which affects efficiency.
The ”proxy-to-proxy” method when using a proxy chain

image.png

In this method, the sender has already specified proxyB as the final endpoint when sending the request, so proxyA will directly forward the request to proxyB, which is more efficient than the first traditional method.

Build proxy chains using gost

gost can use proxy chains to forward data very simply and flexibly.

Suppose we have 2 proxies, namely proxy1:10.10.10.10 (domestic VPS) and proxy2:20.20.20.20 (foreign VPS), and the target host we need to access is example.com(abroad). At this time, accessing example.com directly from our own computer might be very slow or impossible to open. proxy1 can access proxy2 at a faster speed, and proxy2 can access example.com at a very fast speed. At this time, we can form a proxy chain through proxy1 and proxy2 to access example.com。

Method 1:
The configuration on proxy1 is as follows:

gost -L https://guest1:guest1@:8443

The configuration on proxy2 is as follows:

gost -L socks5+tls://guest2:guest2@:1080

The client gost can be configured as follows:

gost -L http://:8080 -F https://guest1:[email protected]:8443 -F socks5+tls://guest2:[email protected]:1080 

Finally, point the HTTP proxy of the client browser to 127.0.0.1:8080 to access example.com faster (of course, the premise of doing this is that the cloud provider's domestic VPS accesses the foreign VPS faster than we access the foreign VPS, which is generally the case).

The advantage of configuring the proxy chain directly on the client gost using multiple -F parameters is flexibility. If there are more proxy nodes, various combinations can also be used to set up the proxy chain. The disadvantage is that if there are multiple clients, the users of each client need to know all the nodes of the proxy chain and the proxy methods used, which makes operation and maintenance management troublesome.

Method 2:
The configuration on proxy1 is as follows:

gost -L https://guest1:guest1@:8443 -F socks5+tls://guest2:[email protected]:1080

The configuration on proxy2 is as follows:

gost -L socks5+tls://guest2:guest2@:1080

The client gost can be configured as follows:

gost -L http://:8080 -F https://guest1:[email protected]:8443

This method actually forms a chain directly between proxy1 and proxy2. The advantage is that the client only needs to know the HTTPS proxy address of proxy1, which is more convenient for operation and maintenance management when there are many clients. The disadvantage is that proxy1 is already bound to proxy2, which is not flexible enough.

Summary

This article mainly introduces the most basic way of setting up a proxy server and implementing a forwarding proxy chain with gost. In fact, this method is widely used in certain fields. Those who know, know, so I won't say more.

gost is really powerful, but because I have other ways to implement some of its other features, such as reverse proxy tunneling, which is actually similar to Cloudflare's tunnel. If my cloud host wants to communicate with my home devices, I could actually use this, but I have already implemented it with tailscale... Another example is the HTTP file service, which I also implemented directly using tailscale for mutual access among all virtual networking devices, so I don't need it either... As for reverse proxy, I use nginx, so all in all, only the proxy server function is useful to me, but this does not detract from the power of gost.

In fact, tailscale + gost is an excellent combination, because each machine deployed with tailscale has a virtual networking address of 100.x.x.x, and since tailscale's communication is inherently encrypted based on wireguard, there is no need for gost to use additional encrypted transmission protocols like TLS; plaintext is perfectly fine. Therefore, you only need to install gost on each of your machines deployed with tailscale to easily and flexibly build your own forwarding proxy chain.

View Related Categories · 3 Matches
📌 Content Structure Prompt:
This content is part of the following knowledge map, where you can view the complete content path: Blog Knowledge Map。
📎 Related Articles
Share this article
The blog content is original, please indicate the source when reposting! The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if needed, you can join theTelegram Groupto discuss questions together.
No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗ
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
Kaomoji
Emoji
Little Dinosaur
Flower!
Previous
Next
       

👋 Welcome to “Wudi's Personal Blog”

Here, long-term exploration is mainly carried out around the following directions:

🧱 Personal Digital Infrastructure and Blog System Construction
☁️ Cloudflare and Network Architecture Practice
🧠 AI and Knowledge System Exploration
🛡️ Network Security and Access Optimization
🎵 Music and Sound Cognition
👁️ Cognitive Perspectives and Worldviews