feat: add GOST relay outbound proxy type#2795
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mihomo already supports
gost-pluginfor Shadowsocks over WebSocket/Mux-WebSocket, but that path is tied to the Shadowsocks plugin flow and does not cover GOST relay transports.GOST relay is useful as a reusable outer hop: a relay server can forward TCP and UDP traffic to an internal proxy service, while the mihomo client only needs to connect to the public relay endpoint. This is especially useful on platforms where running a separate local GOST client is inconvenient, such as Android.
This PR adds native
gost-relaysupport as a standalone outbound proxy type. Other outbound proxies can use it throughdialer-proxy, so the relay transport stays generic without adding protocol-specific relay options to every outbound.What Changed
transport/gost.gost-relayoutbound proxy type.gost-relayto be used as a reusabledialer-proxyhop for existing outbound proxies.relay+tlsrelay+mtlsviamux: truetransport/gostpackage.Example
GOST server
Example: expose a public GOST relay+TLS endpoint and let the mihomo client request the target address.
gost -L "relay+tls://:443?certFile=/etc/gost/server.crt&keyFile=/etc/gost/server.key"If the real Shadowsocks server listens only on the relay server itself:
then mihomo can ask the remote GOST relay to connect to that loopback address from the server side.
mihomo client
Forward Mode
If the GOST relay server is configured to forward to a fixed target itself, like this:
gost -L "relay+tls://:443/127.0.0.1:12345?certFile=/etc/gost/server.crt&keyFile=/etc/gost/server.key"mihomo can configure the relay hop with
forward: true:Notes
gost-relayis intended to be used as adialer-proxyhop for normal outbound proxies such as Shadowsocks, VMess, VLESS, Trojan, and other TCP-capable outbounds.gost-relayconnects to the configured relay endpoint and asks the remote relay server to connect to the target address requested by the upper proxy.forward: truemode, the GOST relay server chooses its own configured forwarding target.udp: trueis enabled on thegost-relayhop. Shadowsocksudp-over-tcpcan still be used through the TCP relay path when the remote Shadowsocks server expects UoT.