### CLI Example for HTTP Forwarding Source: https://gost.run/en/concepts/hop Command-line interface example for starting Gost with an HTTP listener and forwarding requests through a chain that includes socks5+ws. ```bash gost -L http://:8080 -F https://192.168.1.1:8080 -F socks5+ws://192.168.1.2:1080 ``` -------------------------------- ### Start Multiple Proxy Services Source: https://gost.run/en/getting-started/quick-start Configure and run multiple proxy services simultaneously. This example starts an HTTP proxy on port 8080 and a SOCKS5 proxy on port 1080. ```bash gost -L http://:8080 -L socks5://:1080 ``` ```yaml services: - name: service-0 addr: ":8080" handler: type: http listener: type: tcp - name: service-1 addr: ":1080" handler: type: socks5 listener: type: tcp ``` -------------------------------- ### Equivalent Shadowsocks-over-KCP Service Configuration Source: https://gost.run/en/concepts/proxy This is the equivalent configuration for the Shadowsocks-over-KCP example, showing a direct setup combining Shadowsocks and KCP. ```bash gost -L ss+kcp://:8338 ``` -------------------------------- ### KCP Configuration File Example Source: https://gost.run/en/tutorials/protocols/kcp Example JSON structure for an external KCP configuration file. ```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 } ``` -------------------------------- ### Equivalent HTTPS Service Configuration Source: https://gost.run/en/concepts/proxy This is the equivalent configuration for the HTTP-over-TLS example, showing a direct HTTPS service setup. ```bash gost -L https://:8443 ``` -------------------------------- ### Example: Port Forwarding with PROXY Protocol Source: https://gost.run/en/tutorials/proxy-protocol Demonstrates a setup where one GOST service forwards traffic to another, with the receiving service configured to handle PROXY protocol headers. ```bash gost -L tcp://:8000/:8080 -L tcp://:8080/example.com:80?proxyProtocol=1 ``` -------------------------------- ### Execute Commands on Service Lifecycle Events Source: https://gost.run/en/concepts/service Use `preUp`, `postUp`, `preDown`, and `postDown` to run commands before and after a service starts or stops. This example shows basic echo commands. ```yaml services: - name: service-0 addr: :8080 metadata: preUp: - echo pre-up postUp: - echo post-up preDown: - echo pre-down postDown: - echo post-down handler: type: http listener: type: tcp ``` -------------------------------- ### Start Simple-obfs HTTP Server Source: https://gost.run/en/tutorials/protocols/obfs Use this command to start a Simple-obfs HTTP server. Ensure the port is accessible. ```bash gost -L=ss+ohttp://chacha20:123456@:8338 ``` -------------------------------- ### Start SOCKS5 Server with CLI Source: https://gost.run/en/reference/handlers/socks5 Starts a SOCKS5 proxy server listening on port 1080 using the GOST CLI. ```bash gost -L socks://:1080 ``` -------------------------------- ### Start Simple-obfs HTTP Client Source: https://gost.run/en/tutorials/protocols/obfs Use this command to start a Simple-obfs HTTP client. The 'host' parameter can customize the request host. ```bash gost -L=:8080 -F=ss+ohttp://chacha20:123456@server_ip:8338?host=bing.com ``` -------------------------------- ### Start REDU UDP Transparent Proxy (CLI) Source: https://gost.run/en/reference/handlers/redu Use the CLI to start a REDU UDP transparent proxy on port 8080. This is a basic setup for the REDU handler. ```bash gost -L redu://:8080 ``` -------------------------------- ### File Data Source Format Example Source: https://gost.run/en/concepts/hosts Example format for a file used as a host mapper data source. Each line contains an IP address and a hostname, separated by spaces. Lines starting with '#' are treated as comments. ```text # ip host 127.0.0.1 example.com 2001:db8::1 example.com ``` -------------------------------- ### Start Simple-obfs TLS Server Source: https://gost.run/en/tutorials/protocols/obfs Use this command to start a Simple-obfs TLS server. Ensure the port is accessible. ```bash gost -L=ss+otls://chacha20:123456@:8338 ``` -------------------------------- ### MTCP Port Forwarding Server Equivalent Setup Source: https://gost.run/en/tutorials/protocols/mtcp An alternative configuration for MTCP port forwarding using the 'forward' handler, explicitly defining the forwarding target. This is functionally equivalent to the previous example. ```bash gost -L forward+mtcp://:8443/:8080 -L http://:8080 ``` -------------------------------- ### Redis Data Retrieval Example Source: https://gost.run/en/concepts/hop An example of how to retrieve hop node configurations from Redis using the GET command. The value associated with the key should be a JSON string representing an array of node configurations. ```bash > GET gost:hops:hop-0:nodes "[{"name":"http",...},{"name":"socks5",...}]" ``` -------------------------------- ### Start Simple-obfs TLS Client Source: https://gost.run/en/tutorials/protocols/obfs Use this command to start a Simple-obfs TLS client. The 'host' parameter can customize the request host. ```bash gost -L=:8080 -F=ss+otls://chacha20:123456@server_ip:8338?host=bing.com ``` -------------------------------- ### Start TCP Redirect Listener (CLI) Source: https://gost.run/en/reference/handlers/red Starts a Gost instance with a TCP redirect listener on port 8080 using the CLI. This is a basic setup for the red handler. ```bash gost -L red://:8080 ``` -------------------------------- ### HTTP Proxy with Authentication CLI Source: https://gost.run/en/tutorials/protocols/http Start an HTTP proxy with basic user authentication using this CLI command. ```bash gost -L http://user:pass@:8080 ``` -------------------------------- ### Start Gost with PHT Listener (CLI) Source: https://gost.run/en/reference/listeners/pht Use this command to start the Gost service with the PHT listener on port 8080. ```bash gost -L http+pht://:8080 ``` -------------------------------- ### Start TUN Listener with Command Line Source: https://gost.run/en/reference/listeners/tun Use this command to start the TUN listener from the command line, specifying the UDP port and network configuration for the TUN device. ```bash gost -L tun://:8421?net=192.168.123.2/24 ``` -------------------------------- ### Start API Service with Authentication via CLI Source: https://gost.run/en/tutorials/api/overview Start the API service with basic HTTP authentication configured directly in the command line. The username and password are provided as part of the API address. ```bash gost -api user:pass@:18080 ``` -------------------------------- ### Start SOCKS4 Proxy with CLI Source: https://gost.run/en/reference/handlers/socks4 Use this command to start a SOCKS4 proxy listening on port 8080. ```bash gost -L socks4://:8080 ``` -------------------------------- ### CLI TCP Forwarding Example Source: https://gost.run/en/reference/handlers/tcp Use this command to start a TCP forwarder from the command line. It listens on port 8080 and forwards traffic to 192.168.1.1:80. ```bash gost -L tcp://:8080/192.168.1.1:80 ``` -------------------------------- ### Start DTLS Service Source: https://gost.run/en/tutorials/protocols/dtls Use this command to start a DTLS service. Ensure TLS certificates are configured separately. ```bash gost -L dtls://:8443 ``` ```yaml services: - name: service-0 addr: : handler: type: auto listener: type: dtls ``` -------------------------------- ### Start Gost with TLS Listener (Command Line) Source: https://gost.run/en/reference/listeners/tls Use this command to start Gost with a TLS listener on port 8443. Ensure your TLS certificates and keys are correctly configured. ```bash gost -L http+tls://:8443 ``` -------------------------------- ### Start SSHD Service with CLI Source: https://gost.run/en/reference/handlers/sshd Use this command to start an SSHD service using the command-line interface. Authentication is provided directly in the URL. ```bash gost -L sshd://gost:gost@:2222 ``` -------------------------------- ### Gost Server CLI for TUN Tunnel Setup Source: https://gost.run/en/tutorials/tuntap Command to start a Gost server listening on a TUN interface for VPN purposes. The `net` option specifies the network range for the tunnel. ```bash gost -L=tun://:8421?net=192.168.123.1/24 ``` -------------------------------- ### Start HTTP Proxy Service Source: https://gost.run/en/getting-started/quick-start Run an HTTP proxy service listening on port 8080. This is the simplest way to start a proxy without a configuration file. ```bash gost -L http://:8080 ``` ```yaml services: - name: service-0 addr: ":8080" handler: type: http listener: type: tcp ``` -------------------------------- ### Start Gost with Red Listener (CLI) Source: https://gost.run/en/reference/listeners/red Use this command to start Gost with the red listener for TCP transparent proxying. Ensure the port is correctly specified. ```bash gost -L red://:12345 ``` -------------------------------- ### Prometheus Configuration Example Source: https://gost.run/en/tutorials/metrics This is a sample Prometheus configuration file that shows how to scrape metrics from a GOST instance. ```yaml global: scrape_interval: 15s # A list of scrape configurations. scrape_configs: - job_name: 'gost' scrape_interval: 5s static_configs: - targets: ['127.0.0.1:9000'] ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/sd Example JSON response from the HTTP service discovery plugin when a service is retrieved. ```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 Global API Service via CLI Source: https://gost.run/en/tutorials/api/overview Start the global API service using the command line. Specify the listening address for the main GOST service and the API service address. ```bash gost -L http://:8080 -api :18080 ``` ```bash gost -L http://:8080 -api "user:pass@:18080?pathPrefix=/api&accesslog=true" ``` -------------------------------- ### HTTP Plugin Request Example Source: https://gost.run/en/concepts/limiter Example of an HTTP POST request to a plugin server for traffic limiting. Includes scope, service, network, address, client, and source information. ```bash curl -XPOST http://127.0.0.1:8000/limiter \ -d'{"scope":"client","service":"service-0","network":"tcp","addr":"example.com:443","client":"gost","src":"192.168.1.1:12345"}' ``` -------------------------------- ### Start MTCP Listener Source: https://gost.run/en/tutorials/protocols/mtcp Starts an MTCP listener on port 8000. This is the basic command-line usage for setting up an MTCP server. ```bash gost -L mtcp://:8000 ``` -------------------------------- ### Start FTCP Listener with HTTP Source: https://gost.run/en/reference/listeners/ftcp Use this command to start a Gost instance with an FTCP listener on port 8443, serving HTTP traffic. ```bash gost -L http+ftcp://:8443 ``` -------------------------------- ### HTTP Plugin Request Example Source: https://gost.run/en/concepts/hosts Example `curl` command to send a POST request to an HTTP plugin for host mapping. Includes network type, host, and client information. ```bash curl -XPOST http://127.0.0.1:8000/hosts -d '{"network": "ip4", "host":"example.com", "client": "gost"}' ``` -------------------------------- ### Example HTTP Plugin Request Source: https://gost.run/en/concepts/hop This is an example of how to send a request to an HTTP plugin endpoint. The payload includes network, address, client, and source information. ```bash curl -XPOST http://127.0.0.1:8000/hop -d '{"network":"tcp","addr":"example.com:80","client":"gost","src":"192.168.1.1:1234"}' ``` -------------------------------- ### HTTP Plugin Request Example Source: https://gost.run/en/concepts/auth Example of an HTTP POST request to an authentication plugin server. The request body includes username, password, and client address. ```shell curl -XPOST http://127.0.0.1:8000/auth -d '{"username":"gost", "password":"gost", "client":"127.0.0.1:12345"}' ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/hosts Example JSON response from an HTTP plugin, containing a list of IP addresses and an 'ok' status. ```json {"ips": ["1.2.3.4","2.3.4.5"], "ok": true} ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/admission Example successful response from an HTTP admission plugin. A `{"ok": true}` response indicates that the client address is permitted. ```json {"ok": true} ``` -------------------------------- ### Standard SNI Proxy Setup Source: https://gost.run/en/tutorials/protocols/sni Configure a basic SNI proxy that listens on port 443. This setup is suitable for direct SNI proxying. ```bash gost -L sni://:443 ``` ```yaml services: - name: service-0 addr: :443 handler: type: sni listener: type: tcp ``` -------------------------------- ### DNS Query for Non-Mapped Domain (IPv6) Source: https://gost.run/en/tutorials/dns Example of querying for 'example.com' (IPv6), which is mapped and should use the custom mapper. ```bash dig -p 10053 AAAA example.com ``` -------------------------------- ### HTTPS Proxy CLI Source: https://gost.run/en/tutorials/protocols/http Start a standard HTTPS proxy service using this CLI command. ```bash gost -L https://:8443 ``` -------------------------------- ### Start Gost with HTTP/3 Listener Source: https://gost.run/en/reference/listeners/http3 Use this command to start Gost with an HTTP/3 listener on port 8080. Ensure your firewall allows UDP traffic on this port. ```bash gost -L http+http3://:8080 ``` -------------------------------- ### DNS Query for Custom Domain (IPv4) Source: https://gost.run/en/tutorials/dns Example of querying for 'example.org' which should be resolved using the custom host mapper. ```bash dig -p 10053 example.org ``` -------------------------------- ### DNS Query for Non-Mapped Domain (IPv4) Source: https://gost.run/en/tutorials/dns Example of querying for 'example.com' (IPv4), which is not fully mapped and should use the forwarder. ```bash dig -p 10053 example.com ``` -------------------------------- ### HTTP Over KCP CLI Source: https://gost.run/en/tutorials/protocols/http Start an HTTP proxy service over KCP using this CLI command. ```bash gost -L http+kcp://:8080 ``` -------------------------------- ### Start Relay Listener with CLI Source: https://gost.run/en/reference/handlers/relay Starts a GOST Relay listener on port 8421 using the command-line interface. This is a basic setup for the relay handler. ```bash gost -L relay://:8421 ``` -------------------------------- ### CLI Example with Scoped Parameters Source: https://gost.run/en/reference/configuration/cmd Demonstrates setting scoped parameters directly on the command line for both service and forwarding chain configurations. ```bash gost -L ":8080?handler.key1=value1&listener.key2=value2&service.key3=value3" \ -F "http://:8000?hop.key4=value4&node.key5=value5&dialer.key6=value6&connector.key7=value7" ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/auth Example response from an HTTP authentication plugin. The 'ok' field indicates success, and 'id' can be used for subsequent user identification. ```json {"ok": true, "id":"gost"} ``` -------------------------------- ### Simple HTTP File Server Example (CLI) Source: https://gost.run/en/tutorials/file Expose the '/home' directory to port 8080 as an HTTP service using the CLI. ```bash gost -L file://:8080?dir=/home ``` -------------------------------- ### Start Gost with KCP Listener Source: https://gost.run/en/reference/dialers/kcp This command starts a Gost instance with a KCP listener on port 8443, forwarding traffic to an HTTP service on port 8080. ```bash gost -L :8080 -F http+kcp://:8443 ``` -------------------------------- ### HTTP Plugin Request Example Source: https://gost.run/en/concepts/router Example of how to make a request to an HTTP plugin router. The 'dst' parameter is required, and an optional 'id' can be provided for routing tunnel scenarios. ```bash curl -XGET "http://127.0.0.1:8000/router?dst=192.168.1.2&id=1b564300-a2c5-406d-af0c-b7bdb039b0e3" ``` -------------------------------- ### Run HTTP2 Proxy with CLI Source: https://gost.run/en/reference/handlers/http2 Starts an HTTP2 proxy using the command-line interface. Ensure the port is accessible. ```bash gost -L http2://:8443 ``` -------------------------------- ### Start API Service Only via CLI Source: https://gost.run/en/tutorials/api/overview Start only the API service using the command line, allowing dynamic configuration of other components through the API. This is useful when GOST is not running other services. ```bash gost -api :18080 ``` -------------------------------- ### HTTP Over WebSocket CLI Source: https://gost.run/en/tutorials/protocols/http Start an HTTP proxy service over WebSocket using this CLI command. ```bash gost -L http+ws://:8080 ``` ```bash gost -L http+wss://:8080 ``` -------------------------------- ### Start Linux systemd Service Source: https://gost.run/en/getting-started/configuration-overview Manually start the GOST systemd service to begin its operation. ```bash systemctl start gost ``` -------------------------------- ### Configure TUN Server Source: https://gost.run/en/tutorials/tuntap Use this command to start a TUN server. Specify the local listen address, network CIDR, and optionally MTU and DNS servers. ```bash gost -L="tun://:8421?net=192.168.123.1/24" ``` -------------------------------- ### Start iperf3 Service Source: https://gost.run/en/tutorials/redirect Starts the iperf3 service in the default network namespace to measure network performance. ```bash iperf3 -s ``` -------------------------------- ### Simple HTTP File Server Example (YAML) Source: https://gost.run/en/tutorials/file Configure a simple HTTP file server in YAML to expose the '/home' directory on port 8080. ```yaml services: - name: service-0 addr: :8080 handler: type: file metadata: dir: /home listener: type: tcp ``` -------------------------------- ### SNI Connector with Host Alias Source: https://gost.run/en/reference/connectors/sni This command-line configuration demonstrates how to specify a host alias 'example.com' for the SNI connector, which will be used during TLS handshake or HTTP requests. ```bash gost -L :8000 -F sni://:8080?host=example.com ``` -------------------------------- ### Start ICMPv6 Relay Server Source: https://gost.run/en/tutorials/icmp Use this command on the server to start an ICMPv6 relay listener on port 0. ```bash gost -L relay+icmp6://:0 ``` -------------------------------- ### Start ICMPv4 Relay Server Source: https://gost.run/en/tutorials/icmp Use this command on the server to start an ICMPv4 relay listener on port 0. ```bash gost -L relay+icmp://:0 ``` -------------------------------- ### Configure TUN Client Source: https://gost.run/en/tutorials/tuntap Use this command to start a TUN client. Specify the local listen address (often 0 for dynamic), the remote server IP and port, and the client's network CIDR. ```bash gost -L=tun://:0/SERVER_IP:8421?net=192.168.123.2/24 ``` -------------------------------- ### HTTP Plugin Example Response Source: https://gost.run/en/concepts/recorder Example successful response from an HTTP plugin endpoint, indicating that the request was processed. ```json {"ok":true} ``` -------------------------------- ### DNS Proxy with Service Level Bypass (CLI) Source: https://gost.run/en/tutorials/dns Configure a DNS proxy with a service-level bypass rule for 'example.com' using the CLI. ```bash gost -L dns://:10053/1.1.1.1?bypass=example.com ``` -------------------------------- ### File Server with Basic Authentication (CLI) Source: https://gost.run/en/tutorials/file Set up basic authentication for the file service using the CLI by providing username and password in the URL. ```bash gost -L file://user:pass@:8080 ``` -------------------------------- ### Start SOCKS5 Over TLS Service Source: https://gost.run/en/tutorials/protocols/tls Starts a SOCKS5 proxy service over a TLS listener. This provides secure SOCKS5 connections. ```bash gost -L socks5+tls://:8443 ``` -------------------------------- ### Start Standard TLS Service Source: https://gost.run/en/tutorials/protocols/tls Starts a standard TLS service on the specified port. This is the basic configuration for TLS listeners. ```bash gost -L tls://:8443 ``` -------------------------------- ### Start Global Metrics Service via CLI Source: https://gost.run/en/tutorials/metrics Use the -metrics flag to define the global metrics service address and optional authentication/path. ```bash gost -L :8080 -metrics=:9000 ``` ```bash gost -L :8080 -metrics "user:pass@:9000?path=/metrics" ``` -------------------------------- ### Command Line to Configuration File Conversion Example Source: https://gost.run/en/getting-started/configuration-overview Illustrates the conversion of a GOST command-line configuration to its equivalent YAML and JSON file representations. Use this to understand how CLI flags map to structured configuration. ```bash gost -L http://gost:gost@localhost:8080?foo=bar -F socks5+tls://gost:gost@192.168.1.1:8080?bar=baz ``` ```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 ``` ```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" } } } ] } ] } ] } ``` -------------------------------- ### HTTP Over KCP Listener (CLI) Source: https://gost.run/en/tutorials/protocols/kcp Set up an HTTP service over a KCP listener using the CLI. ```bash gost -L http+kcp://:8443 ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/router Example response from an HTTP plugin router, providing the destination and gateway for a given request. ```json {"dst":"192.168.1.0/24","gateway":"192.168.123.2"} ``` -------------------------------- ### HTTP Plugin Example Response Source: https://gost.run/en/concepts/ingress Example JSON response from an HTTP Ingress plugin, providing the endpoint for the requested host. ```json {"endpoint":"4d21094e-b74c-4916-86c1-d9fa36ea677b"} ``` -------------------------------- ### Start Gost with Redu Listener Source: https://gost.run/en/reference/listeners/redu This command starts the Gost application with a Redu listener on port 12345 for UDP transparent proxying. ```bash gost -L redu://:12345 ``` -------------------------------- ### Start Gost with gRPC Listener Source: https://gost.run/en/reference/listeners/grpc This command starts the Gost application with a gRPC listener on port 8443. Ensure the port is not already in use. ```bash gost -L http+grpc://:8443 ``` -------------------------------- ### Service Level Bypass YAML Example Source: https://gost.run/en/concepts/bypass Define a service-level bypass in YAML. This example shows a blacklist bypass where requests to `example.com` will be rejected. ```yaml services: - name: service-0 addr: ":8080" bypass: bypass-0 handler: type: http listener: type: tcp bypasses: - name: bypass-0 matchers: - example.com ``` -------------------------------- ### SSH Public Key Authentication (CLI) Source: https://gost.run/en/reference/listeners/ssh Start Gost with an SSH listener using public key authentication, specifying the path to the authorized keys file. ```bash gost -L http+ssh://gost@:8443?authorizedKeys=/path/to/authorized_keys ``` -------------------------------- ### Start Relay Over MTCP Listener Source: https://gost.run/en/tutorials/protocols/mtcp Starts an MTCP listener for relaying traffic on port 8443. This configuration is used for general-purpose traffic relaying over MTCP. ```bash gost -L relay+mtcp://:8443 ``` -------------------------------- ### Start SOCKS5 Over MTCP Listener Source: https://gost.run/en/tutorials/protocols/mtcp Starts an MTCP listener for SOCKS5 proxy traffic on port 8443. This allows SOCKS5 connections to be multiplexed over MTCP. ```bash gost -L socks5+mtcp://:8443 ``` -------------------------------- ### DNS Proxy with Custom Domain Resolution (CLI) Source: https://gost.run/en/tutorials/dns Configure a DNS proxy with custom host-IP mappings for example.org and example.com using the CLI. ```bash gost -L dns://:10053/1.1.1.1?hosts=example.org:127.0.0.1,example.org:::1,example.com:2001:db8::1 ``` -------------------------------- ### Start Gost with OTLS Listener (Command Line) Source: https://gost.run/en/reference/listeners/otls This command starts the Gost proxy with an OTLS listener on port 8443, configured for HTTP traffic. ```bash gost -L http+otls://:8443 ``` -------------------------------- ### Start Normal Metrics Service via CLI Source: https://gost.run/en/tutorials/metrics Configure the metrics service as a normal service using a specific URI scheme in the CLI command. ```bash gost -L "metrics://user:pass@:18080?path=/metrics" ``` -------------------------------- ### Redis Host Data Example Source: https://gost.run/en/concepts/hosts Example of retrieving host data from Redis using SMEMBERS command. The data format is space-separated IP-host pairs. ```bash > SMEMBERS gost:hosts 1) "127.0.0.1 example.com" 2) "2001:db8::1 example.com" ``` -------------------------------- ### Configure Normal Metrics Service in File Source: https://gost.run/en/tutorials/metrics Set up the metrics service handler with authentication and metadata path in the configuration file. ```yaml services: - name: service-0 addr: ":8080" handler: type: metrics auth: username: user password: pass metadata: path: /metrics listener: type: tcp ``` -------------------------------- ### Hash Strategy CLI Example (Target Host) Source: https://gost.run/en/concepts/selector Specify the hash type as 'host' using the ?hash=host query parameter in the CLI. ```bash gost -L http://:8080?hash=host -F "socks5://192.168.1.1:1080,192.168.1.2:1080?strategy=hash&maxFails=1&failTimeout=10s" ``` -------------------------------- ### Start GOST Relay Service Source: https://gost.run/en/tutorials/redirect Starts the GOST relay service on port 8420 in the default network namespace. This service will be used by other namespaces to forward traffic. ```bash gost -L relay://:8420 ``` -------------------------------- ### Start Multiplexed TLS (mtls) Service Source: https://gost.run/en/tutorials/protocols/tls Starts a multiplexed TLS service using the mtls protocol on the specified port. This leverages the xtaci/smux library for multiplexing. ```bash gost -L mtls://:8443 ``` -------------------------------- ### Start HTTP Over MTCP Listener Source: https://gost.run/en/tutorials/protocols/mtcp Starts an MTCP listener that handles HTTP traffic on port 8443. This combines MTCP's multiplexing with HTTP handling. ```bash gost -L http+mtcp://:8443 ``` -------------------------------- ### Configure TUN Server with Default Gateway and Routes Source: https://gost.run/en/tutorials/tuntap Set up TUN server routing by specifying a default gateway and a list of routes. Packets matching these routes will be forwarded to the client. ```bash gost -L="tun://:8421?net=192.168.123.1/24&gw=192.168.123.2&route=172.10.0.0/16,10.138.0.0/16" ``` -------------------------------- ### Basic File Server Configuration (CLI) Source: https://gost.run/en/tutorials/file Use this CLI command to expose a local directory as an HTTP server. The 'dir' parameter specifies the local file directory to serve, defaulting to the current working directory. ```bash gost -L file://:8080?dir=/path/to/dir ``` -------------------------------- ### Hash Strategy CLI Example (Client IP) Source: https://gost.run/en/concepts/selector Use the hash strategy with the -F flag in the CLI. Client IP is the default hash type. ```bash gost -L http://:8080 -F "socks5://192.168.1.1:1080,192.168.1.2:1080?strategy=hash" ``` -------------------------------- ### Example of Recorded Serial Data (Hexdump) Source: https://gost.run/en/tutorials/serial An example of recorded serial data in hexdump format, showing timestamps and data direction indicators ('>' for sent, '<' for received). ```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 |......@..... | ``` -------------------------------- ### HTTP Plugin Response Example Source: https://gost.run/en/concepts/limiter Example JSON response from an HTTP plugin server indicating input and output traffic limits in bytes per second. ```json {"in":1048576, "out":524288} ```