### iperf3: Server setup Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/tuntap.md Start an iperf3 server to test network throughput. ```bash iperf3 -s ``` -------------------------------- ### Start HTTP Proxy (File) Source: https://github.com/go-gost/docs/blob/master/en/docs/getting-started/quick-start.md Configure and start an HTTP proxy service using a YAML file. This method allows for more complex setups. ```yaml services: - name: service-0 addr: ":8080" handler: type: http listener: type: tcp ``` -------------------------------- ### TAP Tunnel Client File Example Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/tuntap.md YAML configuration for starting a TAP tunnel client. ```yaml services: - name: service-0 addr: :8421 handler: type: tap listener: type: tap metadata: net: 192.168.123.2/24 forwarder: nodes: - name: target-0 addr: SERVER_IP:8421 ``` -------------------------------- ### Full Configuration Example Source: https://github.com/go-gost/docs/blob/master/docs/reference/configuration/file.md This is a comprehensive example showcasing all available configuration options for the application. ```json { "strategy": "round", "maxFails": 1, "failTimeout": 30 } } } ], "chains": [ { "name": "chain-0", "selector": { "strategy": "round", "maxFails": 1, "failTimeout": 30 }, "hops": [ { "name": "hop-0", "interface": "192.168.1.2", "selector": { "strategy": "rand", "maxFails": 3, "failTimeout": 60 }, "bypass": "bypass-0", "nodes": [ { "name": "node-0", "addr": ":1080", "interface": "eth1", "bypass": "bypass-0", "connector": { "type": "socks5", "auth": { "username": "user", "password": "pass" }, "metadata": { "foo": "bar" } }, "dialer": { "type": "tcp", "auth": { "username": "user", "password": "pass" }, "tls": { "caFile": "ca.pem", "secure": true, "serverName": "example.com" }, "metadata": { "bar": "baz" } } } ] } ] } ], "authers": [ { "name": "auther-0", "auths": [ { "username": "user1", "password": "pass1" }, { "username": "user2", "password": "pass2" } ] } ], "admissions": [ { "name": "admission-0", "whitelist": false, "matchers": [ "127.0.0.1", "192.168.0.0/16" ] } ], "bypasses": [ { "name": "bypass-0", "whitelist": false, "matchers": [ "*.example.com", ".example.org", "0.0.0.0/8" ] } ], "resolvers": [ { "name": "resolver-0", "nameservers": [ { "addr": "udp://8.8.8.8:53", "chain": "chain-0", "prefer": "ipv4", "clientIP": "1.2.3.4", "ttl": 60, "timeout": 30 }, { "addr": "tcp://1.1.1.1:53" }, { "addr": "tls://1.1.1.1:853" }, { "addr": "https://1.0.0.1/dns-query", "hostname": "cloudflare-dns.com" } ] } ], "hosts": [ { "name": "hosts-0", "mappings": [ { "ip": "127.0.0.1", "hostname": "localhost" }, { "ip": "192.168.1.10", "hostname": "foo.mydomain.org", "aliases": [ "foo" ] }, { "ip": "192.168.1.13", "hostname": "bar.mydomain.org", "aliases": [ "bar", "baz" ] } ] } ], "tls": { "certFile": "cert.pem", "keyFile": "key.pem", "caFile": "ca.pem" }, "log": { "output": "stderr", "level": "debug", "format": "json", "rotation": { "maxSize": 100, "maxAge": 10, "maxBackups": 3, "localTime": false, "compress": false } }, "profiling": { "addr": ":6060", "enabled": true }, "api": { "addr": ":18080", "pathPrefix": "/api", "accesslog": true, "auth": { "username": "user", "password": "password" }, "auther": "auther-0" }, "metrics": { "addr": ":9000", "path": "/metrics" } } ``` -------------------------------- ### TAP Tunnel Server File Example Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/tuntap.md YAML configuration for starting a TAP tunnel server. ```yaml services: - name: service-0 addr: :8421 handler: type: tap listener: type: tap metadata: name: tap0 net: 192.168.123.1/24 mtu: 1420 ``` -------------------------------- ### Start SSU Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/handlers/ssu.md Starts an SSU listener using the command line. The first example uses the shorthand 'ssu' which defaults to UDP, while the second explicitly specifies 'ssu+udp'. ```bash gost -L ssu://AEAD_CHACHA20_POLY1305:123456@:8338 ``` ```bash gost -L ssu+udp://AEAD_CHACHA20_POLY1305:123456@:8338 ``` -------------------------------- ### SOCKS4 Connector Command Line Example Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/connectors/socks4.md This example shows how to start a GOST service with a SOCKS4 connector using the command line. It listens on port 8000 and forwards traffic through a SOCKS4 proxy at 192.168.1.1:1080. ```bash gost -L :8000 -F socks4://192.168.1.1:1080 ``` -------------------------------- ### Start KCP Listener via CLI Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/kcp.md Use this command to start a KCP listener with a specified configuration file. ```bash gost -L kcp://:8443?kcp.configFile=/path/to/config/file ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/go-gost/docs/blob/master/docs/getting-started/configuration-overview.md An example of a GOST configuration in YAML format, illustrating the structure for services, listeners, handlers, chains, hops, and nodes. This is useful for detailed service setups. ```yaml services: - name: service-0 addr: "localhost:8080" handler: type: http chain: chain-0 auth: username: gost password: gost metadata: foo: bar listener: type: tcp metadata: foo: bar chains: - name: chain-0 hops: - name: hop-0 nodes: - name: node-0 addr: 192.168.1.1:8080 connector: type: socks5 auth: username: gost password: gost metadata: bar: baz dialer: type: tls metadata: bar: baz ``` -------------------------------- ### Start QUIC Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/quic.md Use this command to start a GOST service with a QUIC listener on port 8443. ```bash gost -L http+quic://:8443 ``` -------------------------------- ### Install and Run GOST as a Linux Systemd Service Source: https://context7.com/go-gost/docs/llms.txt Instructions for setting up GOST as a systemd service on Linux, including enabling and starting the service. ```bash # Create /etc/systemd/system/gost.service: # [Unit] # Description=GO Simple Tunnel # After=network.target # [Service] # Type=simple # ExecStart=/usr/local/bin/gost -L=:8080 # Restart=always # [Install] # WantedBy=multi-user.target systemctl enable gost && systemctl start gost ``` -------------------------------- ### Start HTTPS Proxy (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/http.md Start a standard HTTPS proxy service. This is equivalent to using the 'http+tls' scheme. ```bash gost -L https://:8443 ``` ```bash gost -L http+tls://:8443 ``` -------------------------------- ### Host Mapper File Format Example Source: https://github.com/go-gost/docs/blob/master/en/docs/concepts/hosts.md Example format for a file-based host mapper data source. Each line contains an IP address and a hostname, separated by spaces. Lines starting with '#' are comments. ```text # ip host 127.0.0.1 example.com 2001:db8::1 example.com ``` -------------------------------- ### KCP JSON Configuration Example Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/kcp.md Example of a KCP configuration file in JSON format. Refer to kcptun documentation for parameter details. ```json { "key": "it's a secrect", "crypt": "aes", "mode": "fast", "mtu" : 1350, "sndwnd": 1024, "rcvwnd": 1024, "datashard": 10, "parityshard": 3, "dscp": 0, "nocomp": false, "acknodelay": false, "nodelay": 0, "interval": 40, "resend": 0, "nc": 0, "smuxver": 1, "sockbuf": 4194304, "keepalive": 10, "snmplog": "", "snmpperiod": 60, "tcp": false } ``` -------------------------------- ### Bandwidth Limiter Configuration from File Source: https://github.com/go-gost/docs/blob/master/en/docs/concepts/limiter.md Example content for a bandwidth limiter configuration file. Lines starting with '#' are comments. Supports global, subnet, and IP-based limits. ```yaml # ip/cidr input output(optional) $ 100MB 200MB $$ 10MB 192.168.1.1 1MB 10MB 192.168.0.0/16 512KB 1MB ``` -------------------------------- ### Start SOCKS5 over QUIC Listener (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/quic.md Starts a GOST service that listens for SOCKS5 traffic over QUIC on port 8443. ```bash gost -L socks5+quic://:8443 ``` -------------------------------- ### Install PPTP Server on Ubuntu Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/redsocks.md Installs the Point-to-Point Tunneling Protocol server package on Ubuntu systems. ```bash sudo apt-get install pptpd ``` -------------------------------- ### Gost Transparent Proxy Setup Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/redirect.md Use this command to start gost with transparent proxying enabled on port 12345, forwarding traffic to a specified server. ```bash gost -L redirect://:12345 -F http2://SERVER_IP:443?ping=30 ``` -------------------------------- ### Start Standard SOCKS5 Proxy with Authentication (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/socks.md Start a SOCKS5 proxy with username and password authentication, listening on port 1080. ```bash gost -L socks5://user:pass@:1080 ``` -------------------------------- ### JSON Configuration Example Source: https://github.com/go-gost/docs/blob/master/docs/getting-started/configuration-overview.md An example of a GOST configuration in JSON format, mirroring the structure of the YAML example. This is an alternative for users who prefer JSON for configuration. ```json { "services": [ { "name": "service-0", "addr": "localhost:8080", "handler": { "type": "http", "chain": "chain-0", "auth": { "username": "gost", "password": "gost" }, "metadata": { "foo": "bar" } }, "listener": { "type": "tcp", "metadata": { "foo": "bar" } } } ], "chains": [ { "name": "chain-0", "hops": [ { "name": "hop-0", "nodes": [ { "name": "node-0", "addr": "192.168.1.1:8080", "connector": { "type": "socks5", "auth": { "username": "gost", "password": "gost" }, "metadata": { "bar": "baz" } }, "dialer": { "type": "tls", "metadata": { "bar": "baz" } } } ] } ] } ] } ``` -------------------------------- ### Start Multiple Services (File) Source: https://github.com/go-gost/docs/blob/master/en/docs/getting-started/quick-start.md Define and start multiple proxy services, like HTTP and SOCKS5, using a single YAML configuration file. ```yaml services: - name: service-0 addr: ":8080" handler: type: http listener: type: tcp - name: service-1 addr: ":1080" handler: type: socks5 listener: type: tcp ``` -------------------------------- ### Start SOCKS5 Proxy via CLI Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/handlers/socks5.md Use this command to start a SOCKS5 proxy server listening on port 1080. ```bash gost -L socks://:1080 ``` -------------------------------- ### Start HTTP/3 Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/http3.md Use this command to start a GOST server with an HTTP/3 listener on port 8080. ```bash gost -L http+h3://:8080 ``` -------------------------------- ### Start PHT Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/pht.md Use this command to start the GOST service with a PHT listener on port 8080. ```bash gost -L http+pht://:8080 ``` -------------------------------- ### Start SOCKS4 Proxy (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/socks.md Use this command to start a standard SOCKS4 proxy server listening on port 1080. ```bash gost -L socks4://:1080 ``` -------------------------------- ### Start REDU Proxy via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/handlers/redu.md Use this command to start a REDU UDP transparent proxy listening on port 8080. ```bash gost -L redu://:8080 ``` -------------------------------- ### Start Relay Connector via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/connectors/relay.md Use this command to start the Relay connector with specified listening and forwarding addresses. ```bash gost -L :8000 -F relay://:8421 ``` -------------------------------- ### HTTP Plugin - Get Source: https://github.com/go-gost/docs/blob/master/docs/concepts/sd.md Example request to get service information using the HTTP plugin. ```APIDOC #### Request Example - Get ```bash curl -XGET http://127.0.0.1:8000/sd?name=c9ef8f8c-d687-4dca-be7a-1467b6565404 ``` ```json { "services":[ { "id":"c23d4f42-c892-42b3-8b74-88ab6455d33a", "name":"c9ef8f8c-d687-4dca-be7a-1467b6565404", "node":"db670b91-61a5-4f7c-8014-3bbe994446ea", "network":"tcp", "address":"10.42.0.100:80" } ] } ``` ``` -------------------------------- ### Equivalent HTTP Proxy Configuration Source: https://github.com/go-gost/docs/blob/master/docs/concepts/proxy.md This configuration is equivalent to the previous example, directly setting up an HTTP proxy. ```bash gost -L http://:8080 ``` -------------------------------- ### Start Standard Shadowsocks Proxy Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/ss.md Use this command to start a standard Shadowsocks TCP proxy. Specify the encryption method and password. ```bash gost -L ss://chacha20-ietf-poly1305:pass@:8338 ``` -------------------------------- ### Install redsocks on Ubuntu Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/redsocks2.md Use apt-get to install the redsocks package on Ubuntu systems. If the package is unavailable, manual compilation from source is required. ```bash sudo apt-get install redsocks ``` -------------------------------- ### Start Global API Service with Authentication via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/api/overview.md Enable authentication by providing username and password in the API address. Configure path prefix and access log. ```bash gost -L http://:8080 -api "user:pass@:18080?pathPrefix=/api&accesslog=true" ``` -------------------------------- ### Example: Receiving Proxy Protocol Headers Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/proxy-protocol.md This example demonstrates setting up a reverse proxy and a port forwarding service, illustrating how client IP addresses are handled with and without Proxy Protocol headers. ```bash gost -L tcp://:8000/:8080 -L tcp://:8080/example.com:80?proxyProtocol=1 ``` ```bash curl -H"Host: example.com" http://192.168.100.100:8000 ``` ```json { "client":"127.0.0.1:53574", "handler":"tcp", "kind":"handler", "level":"info", "listener":"tcp", "local":"127.0.0.1:8080", "msg":"127.0.0.1:53574 <> 127.0.0.1:8080", "remote":"127.0.0.1:53574", "service":"service-1" } ``` ```bash curl --haproxy-protocol -H"Host:example.com" http://192.168.100.100:8000 ``` ```json { "client":"192.168.100.100:57208", "handler":"tcp", "kind":"handler", "level":"info", "listener":"tcp", "local":"127.0.0.1:8080", "msg":"127.0.0.1:41700 <> 127.0.0.1:8080", "remote":"127.0.0.1:41700", "service":"service-1" } ``` -------------------------------- ### Start SSHD Service via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/handlers/sshd.md Use this command to start a Gost service with the SSHD handler. Authentication credentials are provided directly in the command. ```bash gost -L sshd://gost:gost@:2222 ``` -------------------------------- ### Start Gost with KCP Listener (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/kcp.md This command starts the Gost server with an HTTP service listening on port 8443 using the KCP protocol. ```bash gost -L http+kcp://:8443 ``` -------------------------------- ### Simple HTTP File Server Example (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/file.md Exposes the /home directory via HTTP on port 8080 using the command line. ```bash gost -L file://:8080?dir=/home ``` -------------------------------- ### Start Secure Websocket Listener (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/ws.md Starts a GOST listener for secure Websocket (WSS) connections with TLS encryption on the specified port. ```bash gost -L wss://:8080 ``` -------------------------------- ### CLI Configuration Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/handlers/red.md Example of how to start the TCP Redirect handler using the GOST command-line interface. ```APIDOC ## CLI Configuration ### Description Starts the TCP Redirect handler listening on port 8080. ### Command ```bash gost -L red://:8080 ``` ``` -------------------------------- ### Equivalent HTTPS Proxy Configuration Source: https://github.com/go-gost/docs/blob/master/docs/concepts/proxy.md This configuration is equivalent to the previous example, directly setting up an HTTPS proxy. ```bash gost -L https://:8443 ``` -------------------------------- ### Equivalent Shadowsocks Proxy Configuration Source: https://github.com/go-gost/docs/blob/master/docs/concepts/proxy.md This configuration is equivalent to the previous example, directly setting up a Shadowsocks proxy. ```bash gost -L ss://:8080 ``` -------------------------------- ### Start FTCP Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/ftcp.md Use this command to start a Gost service with an FTCP listener on port 8443, handling HTTP traffic. ```bash gost -L http+ftcp://:8443 ``` -------------------------------- ### Start SS Handler via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/handlers/ss.md Use this command to start the SS handler from the command line, specifying the encryption method and password. ```bash gost -L ss://AEAD_CHACHA20_POLY1305:123456@:8338 ``` -------------------------------- ### SSU Connector Configuration File Example Source: https://github.com/go-gost/docs/blob/master/docs/reference/connectors/ssu.md This configuration file example shows how to set up the SSU connector with UDP as the dialer. It defines services, chains, hops, and nodes, specifying the connector type as 'ssu' and providing authentication details. ```yaml services: - name: service-0 addr: ":8000" handler: type: auto chain: chain-0 listener: type: tcp chains: - name: chain-0 hops: - name: hop-0 nodes: - name: node-0 addr: :8338 connector: type: ssu auth: username: AEAD_CHACHA20_POLY1305 password: "123456" dialer: type: udp ``` -------------------------------- ### TAP Tunnel CLI Usage Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/tuntap.md Example of how to start a TAP tunnel using the GOST CLI with various configuration options. ```bash gost -L="tap://[local_ip]:port[/remote_ip:port]?net=192.168.123.2/24&name=tap0&mtu=1420&route=10.100.0.0/16&gw=192.168.123.1" ``` -------------------------------- ### Equivalent Shadowsocks-over-KCP Configuration Source: https://github.com/go-gost/docs/blob/master/docs/concepts/proxy.md This configuration is equivalent to the previous example, directly setting up a Shadowsocks proxy over KCP. ```bash gost -L ss+kcp://:8338 ``` -------------------------------- ### Get Service Details Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/api/config.md Retrieve the detailed configuration for a specific service, identified by its name. This API is available starting from version 3.1.0. ```sh curl https://gost.run/play/webapi/config/services/service-0 ``` -------------------------------- ### Start Standard SOCKS5 Proxy with Authentication (Configuration File) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/socks.md Configure a SOCKS5 proxy with username and password authentication in a YAML file. ```yaml services: - name: service-0 addr: :1080 handler: type: socks5 auth: username: user password: pass listener: type: tcp ``` -------------------------------- ### Example: Forwarding with PROXY Protocol Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/proxy-protocol.md Demonstrates setting up a forwarding service on port 8000 that forwards to a service on port 8080 configured to receive PROXY protocol headers. ```bash gost -L tcp://:8000/:8080 -L tcp://:8080/example.com:80?proxyProtocol=1 ``` -------------------------------- ### Example Gost proxy command Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/redsocks2.md Illustrates how to start a Gost proxy server that listens on port 8888 and forwards traffic to a remote server at a.b.c.d:8080. This 'a.b.c.d' should be used to replace 'proxy_server_ip' in the iptables configuration. ```bash gost -L :8888 -F a.b.c.d:8080 ``` -------------------------------- ### Client: Set up routing rules Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/tuntap.md Configure routing rules on the client to direct traffic through the TUN interface. This example sets a new default route. ```bash ip route add SERVER_IP/32 dev eth0 # 请根据实际情况替换SERVER_IP和eth0 ip route del default # 删除默认的路由 ip route add default via 192.168.123.2 # 使用新的默认路由 ``` -------------------------------- ### Configuration File Setup for HTTP/3 Dialer Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/dialers/http3.md Configure the HTTP/3 dialer within a GOST configuration file. This example sets up a service listening on port 8080, forwarding to a node on port 8443 using an HTTP/3 dialer. ```yaml services: - name: service-0 addr: ":8080" handler: type: auto chain: chain-0 listener: type: tcp chains: - name: chain-0 hops: - name: hop-0 nodes: - name: node-0 addr: :8443 connector: type: http dialer: type: http3 ``` -------------------------------- ### Enable and Start Linux systemd Service Source: https://github.com/go-gost/docs/blob/master/en/docs/getting-started/configuration-overview.md Commands to enable the GOST systemd service to start on boot and to manually start the service. ```bash systemctl enable gost ``` ```bash systemctl start gost ``` -------------------------------- ### Start UDP Transparent Proxy with Redu (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/redu.md Use this command to start a UDP transparent proxy using the redu listener. Ensure the port is accessible. ```bash gost -L redu://:12345 ``` -------------------------------- ### Enable and Start Systemd Service Source: https://github.com/go-gost/docs/blob/master/docs/getting-started/configuration-overview.md Commands to enable GOST to start on boot and to start the GOST service using Systemd on Linux. These are essential for deploying GOST as a background service. ```bash systemctl enable gost systemctl start gost ``` -------------------------------- ### HTTP Connector Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/connectors/http.md Demonstrates basic command-line usage of the HTTP connector. The second example shows an equivalent explicit configuration. ```bash gost -L :8000 -F 192.168.1.1:8080 ``` ```bash gost -L :8000 -F http://192.168.1.1:8080 ``` -------------------------------- ### Start Shadowsocks Over KCP Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/ss.md Start a Shadowsocks proxy tunneled over KCP. The listener type is set to 'kcp'. ```bash gost -L ss+kcp://:8080 ``` -------------------------------- ### Start HTTP File Server via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/file.md Use this command to start a file server exposing a specified directory. The 'dir' parameter defaults to the current working directory if not provided. ```bash gost -L file://:8080?dir=/path/to/dir ``` -------------------------------- ### Start Shadowsocks Over TLS Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/ss.md Start a Shadowsocks proxy tunneled over TLS. The listener type is set to 'tls'. ```bash gost -L ss+tls://:8443 ``` -------------------------------- ### Start ICMPv6 Server Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/icmp.md Use this command to start an ICMPv6 relay server. Requires root privileges. ```bash gost -L relay+icmp6://:0 ``` -------------------------------- ### Start ICMPv4 Server Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/icmp.md Use this command to start an ICMPv4 relay server. Requires root privileges. ```bash gost -L relay+icmp://:0 ``` -------------------------------- ### Start Regular API Service via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/api/overview.md Run the API as a regular service, enabling all its supported features. Uses 'api+tls' scheme. ```bash gost -L "api+tls://user:pass@:18080?pathPrefix=/api&accessLog=true" ``` -------------------------------- ### iperf3: Client setup Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/tuntap.md Connect to the iperf3 server from the client to test network throughput. ```bash iperf3 -c 192.168.123.1 ``` -------------------------------- ### Start Unencrypted Websocket Listener (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/ws.md Starts a GOST listener for unencrypted Websocket connections on the specified port. ```bash gost -L ws://:8080 ``` -------------------------------- ### Start Relay Over KCP Listener via CLI Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/kcp.md Start a relay listener over a KCP channel using the CLI. ```bash gost -L relay+kcp://:8443 ``` -------------------------------- ### Method Rule Example Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/reverse-proxy.md Matches the HTTP method. ```go Method(`POST`) ``` -------------------------------- ### Output Configuration in YAML Format Source: https://github.com/go-gost/docs/blob/master/docs/reference/configuration/cmd.md Starts an HTTP service and outputs the effective configuration in YAML format. ```bash gost -L http://:8080 -O yaml ``` -------------------------------- ### SNI Proxy with Host Obfuscation (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/protocols/sni.md Sets up an HTTP forwarder to an SNI proxy, specifying 'example.com' as the host for SNI and HTTP Host header. This is used to mask the actual target host. ```bash gost -L http://:8080 -F sni://:443?host=example.com ``` -------------------------------- ### Example Recorded Serial Data Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/serial.md An example of recorded serial data, showing direction, timestamp, and hexdump format. ```text >2023-09-18 10:16:25.117 00000000 60 02 a0 01 70 02 b0 01 c0 01 c0 01 40 02 30 01 |`...p.......@.0.| 00000010 e0 00 30 01 50 02 60 01 40 01 30 01 10 02 f0 00 |..0.P.`.@.0.....| 00000020 20 01 60 01 b0 01 f0 00 10 01 f0 00 c0 01 a0 01 | .`.............| 00000030 40 02 b0 01 10 02 60 02 00 00 00 01 50 01 70 01 |@.....`.....P.p.| 00000040 a0 01 30 01 e0 00 e0 01 40 01 00 01 e0 00 c0 01 |..0.....@.......| 00000050 40 01 e0 00 f0 00 20 02 50 01 10 02 10 01 10 02 |@..... .P.......| 00000060 80 01 20 02 30 01 10 02 30 01 00 01 20 01 10 02 |.. .0...0... ...| <2023-09-18 10:16:25.120 00000000 d0 00 d0 00 10 01 10 02 50 01 e0 00 00 01 d0 01 |........P.......| 00000010 f0 00 10 01 c0 01 40 02 80 01 00 01 20 |......@..... | ``` -------------------------------- ### Output Configuration in JSON Format Source: https://github.com/go-gost/docs/blob/master/docs/reference/configuration/cmd.md Starts an HTTP service and outputs the effective configuration in JSON format. ```bash gost -L http://:8080 -O json ``` -------------------------------- ### Example GOST Metrics Output Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/metrics.md This is an example of the metrics data exposed by GOST, including counters, gauges, and histograms. ```text gost_chain_errors_total{chain="chain-0",host="host-0"} 1 gost_service_handler_errors_total{host="host-0",service="service-0"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.005"} 0 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.01"} 0 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.025"} 0 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.05"} 0 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.1"} 0 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.25"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="0.5"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="1"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="2.5"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="5"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="10"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="15"} 1 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="30"} 2 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="60"} 2 gost_service_request_duration_seconds_bucket{host="host-0",service="service-0",le="+Inf"} 2 gost_service_request_duration_seconds_sum{host="host-0",service="service-0"} 15.172895206 gost_service_request_duration_seconds_count{host="host-0",service="service-0"} 2 gost_service_requests_in_flight{host="host-0",service="service-0"} 0 gost_service_requests_total{host="host-0",service="service-0"} 2 gost_service_transfer_input_bytes_total{host="host-0",service="service-0"} 1018 gost_service_transfer_output_bytes_total{host="host-0",service="service-0"} 7327 gost_services{host="host-0"} 1 ``` -------------------------------- ### Service Discovery Response Example Source: https://github.com/go-gost/docs/blob/master/docs/concepts/sd.md Example JSON response from the service discovery plugin when retrieving service information. ```json { "services":[ { "id":"c23d4f42-c892-42b3-8b74-88ab6455d33a", "name":"c9ef8f8c-d687-4dca-be7a-1467b6565404", "node":"db670b91-61a5-4f7c-8014-3bbe994446ea", "network":"tcp", "address":"10.42.0.100:80" } ] } ``` -------------------------------- ### Start Multiplexed Websocket Listener (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/ws.md Starts a GOST listener for multiplexed Websocket (mws) connections on the specified port. ```bash gost -L mws://:8443 ``` -------------------------------- ### HTTP File Server with Basic Authentication (Command Line) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/file.md Sets up basic authentication for the file server using username 'user' and password 'pass' via the command line. ```bash gost -L file://user:pass@:8080 ``` -------------------------------- ### Start Relay over QUIC Listener (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/quic.md Starts a GOST service that listens for relay traffic over QUIC on port 8443. ```bash gost -L relay+quic://:8443 ``` -------------------------------- ### Simple HTTP File Server Example (Configuration File) Source: https://github.com/go-gost/docs/blob/master/docs/tutorials/file.md Configures a basic HTTP file server to expose the /home directory on port 8080. ```yaml services: - name: service-0 addr: :8080 handler: type: file metadata: dir: /home listener: type: tcp ``` -------------------------------- ### Start MTCP Listener via CLI Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/mtcp.md Use this command to start a Gost instance with an MTCP listener on port 8000. ```bash gost -L mtcp://:8000 ``` -------------------------------- ### Start Multiple Services (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/getting-started/quick-start.md Launch GOST with multiple proxy services, such as HTTP and SOCKS5, simultaneously using command-line flags. ```bash gost -L http://:8080 -L socks5://:1080 ``` -------------------------------- ### SSU Connector Command Line Example Source: https://github.com/go-gost/docs/blob/master/docs/reference/connectors/ssu.md This command line example demonstrates how to configure the SSU connector. The first command is equivalent to the second, which explicitly specifies UDP as the dialer type. ```bash gost -L :8000 -F ssu://AEAD_CHACHA20_POLY1305:123456@:8338 ``` ```bash gost -L :8000 -F ssu+udp://AEAD_CHACHA20_POLY1305:123456@:8338 ``` -------------------------------- ### Start SOCKS4 Proxy via CLI Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/handlers/socks4.md Use this command to start a SOCKS4 proxy server listening on port 8080. ```bash gost -L socks4://:8080 ``` -------------------------------- ### SOCKS Over KCP Server (CLI) Source: https://github.com/go-gost/docs/blob/master/en/docs/tutorials/protocols/socks.md Starts a SOCKS5 server over KCP. ```bash gost -L socks5+kcp://:8080 ``` -------------------------------- ### Start SNI Connector (Command Line) Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/connectors/sni.md Starts the SNI connector listening on port 8000 and forwarding to port 8080. ```bash gost -L :8000 -F sni://:8080 ``` -------------------------------- ### SNI Connector with Host Alias (Command Line) Source: https://github.com/go-gost/docs/blob/master/en/docs/reference/connectors/sni.md Starts the SNI connector with a specified host alias 'example.com'. The SNI client will replace the Host in TLS handshakes or HTTP request headers with this value. ```bash gost -L :8000 -F sni://:8080?host=example.com ``` -------------------------------- ### Start gRPC Listener via Command Line Source: https://github.com/go-gost/docs/blob/master/docs/reference/listeners/grpc.md Use this command to start the gRPC listener on TCP port 8443. ```bash gost -L http+grpc://:8443 ``` -------------------------------- ### Start TCP Redirect Server (CLI) Source: https://github.com/go-gost/docs/blob/master/docs/reference/handlers/red.md Use this command to start a TCP redirect server listening on port 8080. ```bash gost -L red://:8080 ``` -------------------------------- ### HTTP Proxy with Blacklist Bypass (CLI) Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/bypass.md Configure an HTTP proxy service on port 8080 using the command line. Requests to 'example.com' will be rejected, while others are processed. ```bash gost -L http://:8080?bypass=example.com ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/go-gost/docs/blob/master/docs/blog/posts/deploy.md Execute this command to build and start all defined services in the docker-compose.yml file in detached mode. ```bash docker-compose -f docker-compose.yml -p web up -d ``` -------------------------------- ### Enable Trace Logging Source: https://github.com/go-gost/docs/blob/master/docs/reference/configuration/cmd.md Starts an HTTP service and enables trace-level logging for the most detailed information. ```bash gost -L http://:8080 -DD ```