junxnone / linux

Linux wiki
https://junxnone.github.io/linux/
0 stars 0 forks source link

Tools Networks Proxy V2Ray #66

Open junxnone opened 5 years ago

junxnone commented 5 years ago

V2Ray

Reference

Brief

image

支持的协议

Install

Windows 和 Mac OS 安装方式

通过上述方式下载的压缩包,解压之后可看到 v2ray 或 v2ray.exe。直接运行即可。

Linux

自动安装脚本

bash <(curl -L -s https://install.direct/go.sh)

root下执行

Docker Install & Setup

docker pull v2fly/v2fly-core

v2ray/official moved to v2fly/v2fly-core

Server&Client

$ sudo docker run -d --name v2ray -e TZ=Asia/Shanghai -v /etc/v2ray:/etc/v2ray -p 8888:8888 --restart always v2fly/v2fly-core run -c /etc/v2ray/config.json

polipo 局域网代理 同shadowsocks,端口更改为 v2ray 映射的端口即可

Setup Config

更换xxxxx 为你的server ip/port/id

{
  "log": {
    "loglevel": "warning",
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log"
  },
  "inbounds": [
    {
      "port": xxxxx,
      "protocol": "vmess",    
      "settings": {
        "clients": [
          {
            "id": "xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            "alterId": 64
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    }
  ]
}

  "log": {
    "loglevel": "warning",
    "access": "/etc/v2ray/access.log",
    "error": "/etc/v2ray/error.log"
  },
  "inbounds": [
    {
      "port": 1080,
      "protocol": "http",
      "sniffing": {
        "enabled": true,
        "destOverride": ["http", "tls"]
      },
      "settings": {
        "auth": "noauth"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "xxx.xxx.xxx.xxx",
            "port": xxxxx,
            "users": [
              {
                "id": "xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",  
                "alterId": 64
              }
            ]
          }
        ]
      }
    },
    {
      "protocol": "freedom",
      "settings": {},
      "tag": "direct"
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "adblock"
    }
  ],
  "routing": {
    "domainStrategy": "IPOnDemand",
    "rules": [
      {
        "domain": [
          "tanx.com",
          "googeadsserving.cn",
          "baidu.com"
        ],
        "type": "field",
        "outboundTag": "adblock"       
      },
      {
        "domain": [
          "amazon.com",
          "microsoft.com",
          "jd.com",
          "youku.com",
          "baidu.com"
        ],
        "type": "field",
        "outboundTag": "direct"
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "domain":["geosite:cn"]
      },
      {
        "type": "field",
        "outboundTag": "direct",
        "ip": [
          "geoip:cn",
          "geoip:private"
        ]
      }
    ]
  }
}

路由

通过多个出口 outbounds 设定

  • freedom 无代理
  • blackhole 屏蔽

History

Diff with Shadowsocks