title: 【记录】Warp 与 Tor 共存 urlname: -ji-lu-Warp-yu-Tor-gong-cun date: 2023-07-01 19:52:07
运行 bash api.sh -i -f ./warp-account.conf
获取 reserved
mkdir -p ~/app/tor && cd ~/app/tor && nano Dockerfile && nano docker-compose.yml
echo 'SocksPort 0.0.0.0:9050' > torrc
docker build -t limour/tor .
docker image ls | grep limour/tor
sudo docker network create sswitch
sudo docker-compose up -d && sudo docker-compose logs
docker run --rm --net=sswitch alpine/curl --socks5-hostname "tor:9050" "https://check.torproject.org/api/ip"
# set alpine as the base image of the Dockerfile
FROM alpine:latest
# update the package repository and install Tor
RUN apk update && apk --no-cache add tor
# Copy over the torrc created above and set the owner to `tor`
COPY torrc /etc/tor/torrc
RUN chown -R tor /etc/tor
# Set `tor` as the default user during the container runtime
USER tor
# Set `tor` as the entrypoint for the image
ENTRYPOINT ["tor"]
# Set the default container command
# This can be overridden later when running a container
CMD ["-f", "/etc/tor/torrc"]
version: '3.3'
services:
tor:
restart: always
image: limour/tor
networks:
default:
external: true
name: sswitch
安装好 docker
mkdir -p ~/app/socks5 && cd ~/app/socks5 && nano docker-compose.yml
mkdir ./config
nano ./config/config.json
wget https://github.com/SagerNet/sing-geoip/releases/latest/download/geoip.db -O config/geoip.db
wget https://github.com/SagerNet/sing-geosite/releases/latest/download/geosite.db -O config/geosite.db
sudo docker-compose up -d && sudo docker-compose logs
{
"log": {
"level": "info"
},
"inbounds": [
{
"type": "socks",
"tag": "socks-in",
"listen": "::",
"listen_port": 5353,
"tcp_fast_open": false,
"udp_fragment": true,
"sniff": true,
"sniff_override_destination": false,
"sniff_timeout": "300ms",
"udp_timeout": 300,
"proxy_protocol": false,
"proxy_protocol_accept_no_header": false
}
],
"outbounds": [
{
"type": "direct"
},
{
"type": "wireguard",
"tag": "wireguard",
"server": "engage.cloudflareclient.com",
"server_port": 2408,
"local_address": ["10.0.0.2/32"],
"private_key": "记录的private_key",
"peer_public_key": "记录的public_key",
"reserved": [0, 0, 0] // 记录的reserved值
},
{
"type": "socks",
"tag": "tor",
"server": "tor",
"server_port": 9050
}
],
"route": {
"rules": [
{
"domain_suffix": [".onion"],
"outbound": "tor"
},
{
"domain_suffix": ["openai.com"],
"outbound": "wireguard"
},
{
"domain_suffix": [".cn"],
"outbound": "wireguard"
},
{
"domain_suffix": ["check.torproject.org"],
"outbound": "tor"
},
{
"domain_suffix": ["myip.ipip.net"],
"outbound": "wireguard"
},
{
"geoip": ["cn"],
"outbound": "wireguard"
},
{
"geosite": ["cn"],
"outbound": "wireguard"
},
{
"domain_keyword": ["bing","microsoft"],
"outbound": "wireguard"
}
]
}
}
version: '3.3'
services:
socks5:
restart: always
volumes:
- './config/:/etc/sing-box/'
image: gzxhwq/sing-box:git
networks:
default:
external: true
name: sswitch
docker run --rm --net=sswitch alpine/curl --socks5-hostname socks5:5353 https://myip.ipip.net
docker run --rm --net=sswitch alpine/curl --socks5-hostname socks5:5353 https://api.ipify.org/?format=json
docker run --rm --net=sswitch alpine/curl --socks5-hostname "socks5:5353" "https://check.torproject.org/api/ip"
docker run --rm --net=sswitch alpine/curl --socks5-hostname "socks5:5353" "https://www.nytimesn7cgmftshazwhfgzm37qxb44r64ytbb2dj3x62d2lljsciiyd.onion"