User Tools

Site Tools


linux:v2ray

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:v2ray [2019/07/13 15:37] percylinux:v2ray [2021/10/02 22:30] – [Config file for client] percy
Line 45: Line 45:
 or run v2ray-core and register it to launch at login via: or run v2ray-core and register it to launch at login via:
   brew services start v2ray-core   brew services start v2ray-core
 +  brew services restart v2ray-core
  
 +===== Router Install =====
 +Download the correct version
 +  - https://github.com/v2ray/v2ray-core/releases/
 +  wget -cS https://github.com/v2ray/v2ray-core/releases/download/v4.20.0/v2ray-linux-arm.zip
 +  unzip v2ray-linux-arm.zip
 +Then copy all the files to the router
 +  scp -r v2ray root@miwifi.com:/userdisk/data/bin/v2ray
 +Add execution permission
 +  chmod +x v2ray
 +  chmod +x v2ctl
 +Update the config.json, the run v2ray
 +  ./v2ray --config=config.json
 +Testing the connection
 +  curl -x socks5://127.0.0.1:1088 google.com
 +Reference
 +  - https://www.v2ray.com/chapter_02/protocols/dokodemo.html
  
 ===== Reference ===== ===== Reference =====
 - https://toutyrater.github.io/basic/routing/cndirect.html - https://toutyrater.github.io/basic/routing/cndirect.html
  
-==== Config file for client ==== +===== Config file for server =====
 <file json> <file json>
 { {
-  "log": { 
-    "loglevel": "warning" 
-  }, 
   "inbounds": [{   "inbounds": [{
-    "port": 1080,+    "port": 2130x,
     "listen": "127.0.0.1",     "listen": "127.0.0.1",
-    "tag": "socks-inbound", +    "protocol": "vmess",
-    "protocol": "socks",+
     "settings": {     "settings": {
-      "auth": "noauth", +      "clients":
-      "udp": false+        { 
-      "ip": "127.0.0.1"+          "id": "58ceb1c6-b580-4d2c-bf41-21b6a35xxxx", 
 +          "level": 1
 +          "alterId": 64 
 +        } 
 +      ]
     },     },
-    "sniffing": { + "streamSettings": { 
-      "enabled": true+ "network": "ws"
-      "destOverride": ["http", "tls"] + "wsSettings": 
-    +     "path": "/xxxxxxx" 
-  }],+ }, 
 + "kcpSettings": { 
 +   "uplinkCapacity": 50, 
 +   "downlinkCapacity": 100, 
 +   "congestion": true, 
 +   "header":
 + "type": "none" 
 +   } 
 + } 
 +
 +  } 
 +  ],
   "outbounds": [{   "outbounds": [{
-    "protocol": "vmess", 
-    "settings": { 
- "vnext": [{ 
- "address": "ef.pjq.mx", 
- "port": 2710x, 
- "users": [{ "id": "58ceb1c6-b580-4d2c-bf41-21b6a35ae62x" }] 
- }] 
-    } 
-  },{ 
     "protocol": "freedom",     "protocol": "freedom",
-    "settings": {}+    "settings": {}
-    "tag": "direct"+
   },{   },{
     "protocol": "blackhole",     "protocol": "blackhole",
Line 91: Line 108:
   }],   }],
   "routing": {   "routing": {
-    "domainStrategy": "IPOnDemand", +    "rules":
-    "rules":+      {
- +
-          "type": "field", +
-           "outboundTag": "direct", +
-           "domain": ["geosite:cn"+
-        }, +
-        { +
-           "type": "field", +
-           "outboundTag": "direct", +
-           "ip":+
-             "geoip:cn", +
-             "geoip:private" +
-           ] +
-        }, +
-       {+
         "type": "field",         "type": "field",
-        "domain": ["geosite:category-ads"],+        "ip": ["geoip:private"],
         "outboundTag": "blocked"         "outboundTag": "blocked"
-       }+      }
     ]     ]
   },   },
 + "log": {
 +  "access": "/var/log/v2ray/access.log",
 +  "loglevel": "info",
 +  "error": "/var/log/v2ray/error.log"
 + }
 +}
 +</file>
  
 +==== Config file for client ====
 +
 +<code json>
 +{
   "dns": {   "dns": {
-    "hosts": { 
-      "domain:v2ray.com": "www.vicemc.net", 
-      "domain:github.io": "pages.github.com", 
-      "domain:wikipedia.org": "www.wikimedia.org", 
-      "domain:shadowsocks.org": "electronicsrealm.com" 
-    }, 
     "servers": [     "servers": [
-      "1.1.1.1", +      "1.1.1.1"
-      { +
-        "address": "114.114.114.114", +
-        "port": 53, +
-        "domains":+
-          "geosite:cn" +
-        ] +
-      }, +
-      "8.8.8.8", +
-      "localhost"+
     ]     ]
   },   },
 +  "inbounds":
 +    { 
 +      "port": 10808, 
 +      "protocol": "socks", 
 +      "settings":
 +        "auth": "noauth", 
 +        "udp": true, 
 +        "userLevel":
 +      }, 
 +      "sniffing":
 +        "destOverride":
 +          "http", 
 +          "tls" 
 +        ], 
 +        "enabled": true 
 +      }, 
 +      "tag": "socks" 
 +    }, 
 +    { 
 +      "port": 10809, 
 +      "protocol": "http", 
 +      "settings":
 +        "userLevel":
 +      }, 
 +      "tag": "http" 
 +    } 
 +  ], 
 +  "log":
 +    "loglevel": "warning" 
 +  }, 
 +  "outbounds":
 +    { 
 +      "mux":
 +        "enabled": false 
 +      }, 
 +      "protocol": "vmess", 
 +      "settings":
 +        "vnext":
 +          { 
 +            "address": "pjq.me", 
 +            "port": 443, 
 +            "users":
 +              { 
 +                "alterId": 64, 
 +                "id": "58ceb1c6-b580-4d2c-bf41-21bxxxxxxxxxx", 
 +                "level": 8, 
 +                "security": "aes-128-gcm" 
 +              } 
 +            ] 
 +          } 
 +        ] 
 +      }, 
 +      "streamSettings":
 +        "network": "ws", 
 +        "security": "tls", 
 +        "tlssettings":
 +          "allowInsecure": true, 
 +          "serverName": "" 
 +        }, 
 +        "wssettings":
 +          "connectionReuse": true, 
 +          "headers":
 +            "Host": "" 
 +          }, 
 +          "path": "xxxxx" 
 +        } 
 +      }, 
 +      "tag": "proxy" 
 +    }, 
 +    { 
 +      "protocol": "freedom", 
 +      "settings": {}, 
 +      "tag": "direct" 
 +    }, 
 +    { 
 +      "protocol": "blackhole", 
 +      "settings":
 +        "response":
 +          "type": "http" 
 +        } 
 +      }, 
 +      "tag": "block" 
 +    } 
 +  ],
   "policy": {   "policy": {
     "levels": {     "levels": {
-      "0": { +      "8": { 
-        "uplinkOnly": 0+        "connIdle": 300
-        "downlinkOnly": 0+        "downlinkOnly": 1, 
 +        "handshake": 4, 
 +        "uplinkOnly": 1
       }       }
     },     },
     "system": {     "system": {
-      "statsInboundUplink": false+      "statsInboundUplink": true
-      "statsInboundDownlink": false+      "statsInboundDownlink": true
     }     }
   },   },
-  "other": {}+  "routing": { 
 +    "rules":
 +      { 
 +         "type": "field", 
 +         "inboundTag": ["dokodemo", "http", "socks"], 
 +         "outboundTag": "proxy" 
 +        } 
 +    ] 
 +  }, 
 +  "stats": {}, 
 +  "inboundDetour":
 +    { 
 +       "protocol":"dokodemo-door", 
 +       "port":1099, 
 +       "tag": "dokodemo", 
 +       "settings":
 +          "address":"", 
 +          "network":"tcp", 
 +          "timeout":0, 
 +          "followRedirect":true 
 +       } 
 +     } 
 +  ]
 } }
-</file>+</code> 
 + 
 +==== v2ray with nginx ==== 
 +- https://tlanyan.me/v2ray-traffic-mask/ 
  
/var/www/dokuwiki/wiki/data/pages/linux/v2ray.txt · Last modified: 2021/10/02 22:32 by percy