nikotung / daily-git

daily records
0 stars 0 forks source link

proxy trojan-go traffic with v2ray #8

Open nikotung opened 2 years ago

nikotung commented 2 years ago

docker-compose file

version: "3.9"

  services:
    v2ray:
      image: v2fly/v2fly-core:latest
      container_name: v2fly
      ports:
        - 443:443
      volumes:
        - ${PWD}/v2ray.json:/etc/v2ray/config.json
      depends_on:
        - trojan-go
      networks:
        - free

    trojan-go:
      image: p4gefau1t/trojan-go:latest
      container_name: trojan_forward
  #    ports:
  #      - 1080:1080
      volumes:
        - ${PWD}/config-client-docker.json:/etc/trojan-go/config.json
        - ${PWD}/geoip.dat:/etc/trojan-go/geoip.dat
        - ${PWD}/geoip-only-cn-private.dat:/etc/trojan-go/geoip-only-cn-private.dat
        - ${PWD}/geosite.dat:/etc/trojan-go/geosite.dat
      networks:
        - free

  networks:
    free:
      name: free_network
nikotung commented 2 years ago

v2ray server file

    {
      "log": {
        "access": "/var/log/v2ray/access.log",
        "error": "/var/log/v2ray/error.log",
        "loglevel": "warning"
      },
      "inbounds": [{
        "port": 443,
        "protocol": "vmess",
        "settings": {
          "clients": [
            {
              "id": "8ef39e-3709-47fa-85b5-aadf69906cc9",
              "level": 1,
              "alterId": 2
            }
          ]
        }
      }],
      "outbounds": [{
          "protocol": "socks",
          "settings": {
            "servers": [{
                "address": "trojan-go",
                "port": 1080
              }]
          }
        }]
    }
nikotung commented 2 years ago

trojan-go client config file

    {
        "local_addr": "0.0.0.0",
        "local_port": 1080,
        "mux":
        {
            "enabled": true
        },
        "password":
        [
            "your_password"
        ],
        "log_level": 4,
        "remote_addr": "your_domain",
        "remote_port": 443,
        "router":
        {
            "block":
            [
                "geosite:category-ads"
            ],
            "bypass":
            [
                "geoip:cn",
                "geoip:private",
                "geosite:cn",
                "geosite:private"
            ],
            "default_policy": "proxy",
            "enabled": true,
            "geoip": "/etc/trojan-go/geoip.dat",
            "geosite": "/etc/trojan-go/geosite.dat",
            "proxy":
            [
                "geosite:geolocation-!cn"
            ]
        },
        "run_type": "client",
        "ssl":
        {
            "sni": "your_domain"
        },
        "websocket":
        {
            "enabled": true,
            "host": "your_domain",
            "path": "/websocketpath"
        }
    }