8000 使用V2搭建Socks5代理 · Issue #13 · dalaolala/blog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
使用V2搭建Socks5代理 #13
Open
@dalaolala

Description

@dalaolala

1、安装v2ray

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

service v2ray start   //启动v2ray
service v2ray stop    //停止v2ray
service v2ray restart     //重新启动v2ray

####2、 相关配置
相关的配置文件在 /etc/v2ray/config.json

{
"inbounds": [
    {
    "protocol": "socks",
    "port": 12345,
    "settings": {
        "auth": "password",
        "accounts": [
        {
            "user": "test",
            "pass": "password"
        }
        ],
        "udp": false,
        "ip": "127.0.0.1",
        "userLevel": 0
    }
    }
],
"outbounds": [
    {
    "protocol": "freedom",
    "settings": {}
    },
    {
    "protocol": "blackhole",
    "settings": {},
    "tag": "blocked"
    }
],
"routing": {
    "rules": [
    {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
    }
    ]
}
}

说明

socket5代理本身没有什么卵用,很容易识别!
但是用国内的nat机来转发到国外的vmess或者ss协议还是很合适的

上面配置中:

  • Socks 协议的认证方式,支持"noauth"匿名方式和"password"用户密码方式。
  • 只有当 auth 为 password 时,用户名和密码才有效。
  • 如果不需要用户名和密码,将 auth 设置为 noauth

利用s5中转到tls+ws+nginx配置

小提示:可以参考v2rayNG的配置文件

{
  "policy": {
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true
    }
  },
  "log": {
    "access": "",
    "error": "",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "tag": "proxy",
      "port": 10082,
      "listen": "0.0.0.0",
      "protocol": "socks",
      "sniffing": {
        "enabled": true,
        "destOverride": [
          "http",
          "tls"
        ]
      },
      "settings": {
        "auth": "password",
		"accounts": [
        {
            "user": "test",
            "pass": "test"
        }
        ],
        "udp": true,
        "ip": null,
        "address": null,
        "clients": null
      },
      "streamSettings": null
    },
    {
      "tag": "api",
      "port": 53984,
      "listen": "127.0.0.1",
      "protocol": "dokodemo-door",
      "sniffing": null,
      "settings": {
        "auth": null,
        "udp": false,
        "ip": null,
        "address": "127.0.0.1",
        "clients": null
      },
      "streamSettings": null
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "xx.xx.com",
            "port": 443,
            "users": [
              {
                "id": "000001ae-7dd7-4c77-96cc-e5b55a800000",
                "alterId": 64,
                "email": "t@t.tt",
                "security": "auto"
              }
            ]
          }
        ],
        "servers": null,
        "response": null
      },
      "streamSettings": {
        "network": "ws",
        "security": "tls",
        "tlsSettings": {
          "allowInsecure": true,
          "serverName": null
        },
        "tcpSettings": null,
        "kcpSettings": null,
        "wsSettings": {
          "connectionReuse": true,
          "path": "/ws",
          "headers": null
        },
        "httpSettings": null,
        "quicSettings": null
      },
      "mux": {
        "enabled": true
      }
    },
    {
      "tag": "direct",
      "protocol": "freedom",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": null
      },
      "streamSettings": null,
      "mux": null
    },
    {
      "tag": "block",
      "protocol": "blackhole",
      "settings": {
        "vnext": null,
        "servers": null,
        "response": {
          "type": "http"
        }
      },
      "streamSettings": null,
      "mux": null
    }
  ],
  "stats": {},
  "api": {
    "tag": "api",
    "services": [
      "StatsService"
    ]
  },
  "dns": null,
  "routing": {
    "domainStrategy": "IPIfNonMatch",
    "rules": [
      {
        "type": "field",
        "port": null,
        "inboundTag": "api",
        "outboundTag": "api",
        "ip": null,
        "domain": null
      },
      {
        "type": "field",
        "port": null,
        "inboundTag": null,
        "outboundTag": "block",
        "ip": [
          "127.0.0.1"
        ],
        "domain": null
      }
    ]
  }
}

举一反三 可以用MTProto中转别的协议

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "port": 8080,
      "protocol": "mtproto",
      "listen":"0.0.0.0",
      "tag" : "mtproto-in",
      "settings": {
        "users" : [{"secret":"secret"}]
      }
    }
  ],
  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vmess",
      "settings": {
        "vnext": [
          {
            "address": "serverhost",
            "port": serverport,
            "users": [
              {
                "id": "0800d1b0-ff44-44c3-b5ab-af1960a0b7c5",
                "alterId": 64,
                "email": "t@t.tt",
                "security": "aes-128-gcm"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp"
      },
      "mux": {
        "enabled": true
      }
    },
    {
      "protocol": "mtproto",
      "settings": {},
      "tag": "mtproto-out",
      "proxySettings" : {
        "tag": "proxy"
      }
    }
  ],
  "dns": null,
  "routing": {
    "rules": [
      {
        "type": "field",
        "ip": ["geoip:private"],
        "outboundTag": "blocked"
      },
      {
        "type": "field",
        "inboundTag": ["mtproto-in"],
        "outboundTag": "mtproto-out"
      }
    ]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0