网络

树莓派使用透明代理

By jere on 2019-06-20 0 Comments

树莓派可以用作透明代理

前后折腾了不少时间,这篇文章还是比较靠谱的。

发现我的 5353 被占用了,更改的其他端口,同样需要更改 list 文件。

如下是客户端文件,用的是 nls+websocket方法

{
  "log" : {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "debug"
  },
  "inbounds": [
    {
      "port": "你的端口",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "auth": "noauth"
      }
    }
  ],
  "outbounds": [{
      "sendThrough": "0.0.0.0",
      "mux": {
        "enabled": false,
        "concurrency": 4
      },
      "protocol": "vmess",
      "settings": {
        "vnext": [{
          "address": "地址 1",
          "users": [{
            "id": "你的 id",
            "alterId": 64,
            "security": "你的方法",
            "level": 0
          }],
          "port": 你的端口
        }]
      },
      "tag": "名称 1",
      "streamSettings": {
        "wsSettings": {
          "path": "\/你的地址,比如/x",
          "headers": {
            "Host": "主机名"
          }
        },
        "quicSettings": {
          "key": "",
          "header": {
            "type": "none"
          },
          "security": "none"
        },
        "tlsSettings": {
          "allowInsecure": true,
          "alpn": [
            "http\/1.1"
          ],
          "serverName": "主机名",
          "allowInsecureCiphers": false
        },
        "httpSettings": {
          "path": ""
        },
        "kcpSettings": {
          "header": {
            "type": "none"
          },
          "mtu": 1350,
          "congestion": false,
          "tti": 20,
          "uplinkCapacity": 5,
          "writeBufferSize": 1,
          "readBufferSize": 1,
          "downlinkCapacity": 20
        },
        "tcpSettings": {
          "header": {
            "type": "none"
          }
        },
        "security": "tls",
        "network": "ws"
      }
    },
    {
      "sendThrough": "0.0.0.0",
      "mux": {
        "enabled": false,
        "concurrency": 2
      },
      "protocol": "vmess",
      "settings": {
        "vnext": [{
          "address": "地址 2",
          "users": [{
            "id": "你的id",
            "alterId": 64,
            "security": "你的方法",
            "level": 0
          }],
          "port": 你的端口
        }]
      },
      "tag": "名称 2",
      "streamSettings": {
        "wsSettings": {
          "path": "\/路径",
          "headers": {

          }
        },
        "quicSettings": {
          "key": "",
          "header": {
            "type": "none"
          },
          "security": "none"
        },
        "tlsSettings": {
          "allowInsecure": true,
          "alpn": [
            "http\/1.1"
          ],
          "serverName": "地址 2",
          "allowInsecureCiphers": false
        },
        "httpSettings": {
          "path": ""
        },
        "kcpSettings": {
          "header": {
            "type": "none"
          },
          "mtu": 1350,
          "congestion": false,
          "tti": 20,
          "uplinkCapacity": 5,
          "writeBufferSize": 1,
          "readBufferSize": 1,
          "downlinkCapacity": 20
        },
        "tcpSettings": {
          "header": {
            "type": "none"
          }
        },
        "security": "tls",
        "network": "ws"
      }
    },
    {
      "protocol": "freedom",
      "settings": {},
      "streamSettings": {
        "sockopt": {
          "mark": 255
        }
      },
      "tag": "direct"
    }
  ],
  "routings": [{
    "rules": [{
      "type": "field",
      "inboundTag": ["fport"],
      "outboundTag": ["地址 1", "地址 2"]
    },
    {
      "type": "field",
      "outboundTag": "direct",
      "domain": ["geosite:cn"]
    }, {
      "type": "field",
      "outboundTag": "direct",
      "ip": [
        "geoip:cn",
        "geoip:private"
      ]
    }]
  }],
  "inboundDetour": [
   {
     "domainOverride": ["tls","http"],
     "port":  这个和后面的端口一致,
     "protocol": "dokodemo-door",
     "settings": {
       "network": "tcp,udp",
       "followRedirect": true
     },
     "sniffing": {
       "enabled": true,
       "destOverride": ["http", "tls"]
     },
     "tag": "fport"
   },
   {
    "tag": "dns",
    "protocol": "dokodemo-door",
    "port": 5354,
    "listen": "127.0.0.1",
    "settings": {
      "address": "8.8.8.8",
      "port": 53,
      "network": "tcp,udp",
      "timeout": 30,
      "followRedirect": false
    }
  }],
  "dns": {
    "servers": [
      "8.8.8.8",
      "localhost"
    ]
  }
}

打赏

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用*标注