macronut / phantomsocks

A cross-platform proxy client/server for Linux/Windows/macOS
GNU Lesser General Public License v3.0
453 stars 18 forks source link

Can't connect... #28

Closed ghost closed 2 years ago

ghost commented 2 years ago

I followed your steps, but it seems can't access, do I need to do anything else? the following is my configure and detailed process.the platform is ArchLinux.

# default.conf
method=w-ack,w-time,w-md5

server=tfo://8.8.8.8:53 
server=tcp://8.8.8.8:53
server=tls://8.8.4.4:853

#wikimedia
ttl=12
method=ttl,w-ack,w-time,w-md5,w-seq,s-seg,https
wikipedia.com=91.198.174.192,208.80.153.224
.m.wikipedia.org=[wikipedia.com]
wikipedia.org=[wikipedia.com]
.wikipedia.org=[wikipedia.com]
wikinews.org=[wikipedia.com]
.wikinews.org=[wikipedia.com]
wikidata.org=[wikipedia.com]
.wikidata.org=[wikipedia.com]
wiktionary.org=[wikipedia.com]
.wiktionary.org=[wikipedia.com]
wikiquote.org=[wikipedia.com]
.wikiquote.org=[wikipedia.com]
wikibooks.org=[wikipedia.com]
.wikibooks.org=[wikipedia.com]
wikisource.org=[wikipedia.com]
.wikisource.org=[wikipedia.com]
wikiversity.org=[wikipedia.com]
.wikiversity.org=[wikipedia.com]
wikivoyage.org=[wikipedia.com]
.wikivoyage.org=[wikipedia.com]
mediawiki.org=[wikipedia.com]
.mediawiki.org=[wikipedia.com]
wikimedia.org=[wikipedia.com]
.wikimedia.org=[wikipedia.com]
lists.wikimedia.org=208.80.154.21
techblog.wikimedia.org=192.0.66.216
payments.wikimedia.org=208.80.155.5
upload.wikimedia.org=208.80.154.240,91.198.174.208
.upload.wikimedia.org=[upload.wikimedia.org]
maps.wikimedia.org=[upload.wikimedia.org]
.maps.wikimedia.org=[upload.wikimedia.org]
wikimediafoundation.org=192.0.66.1,192.0.66.2,192.0.66.3,192.0.66.4
.wikimediafoundation.org=[wikimediafoundation.org]
wmfusercontent.org=[wikipedia.com]
.wmfusercontent.org=[wikipedia.com]
w.wiki=[wikipedia.com]

#Pixiv
pixiv.net
.pixiv.net

#Steam
store.steampowered.com
.steamstatic.com

#GitHub
method=ttl,mode2,https
.github.com
github.com
.githubusercontent.com
raw.githubusercontent.com
.raw.githubusercontent.com
~/Documents/phantomsocks master !2 ?1 ❯ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp2s0f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:00:00:00:00:01 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    link/ether 00:00:00:00:00:02 brd ff:ff:ff:ff:ff:ff

~/Documents/phantomsocks master !2 ?1 ❯ sudo iptables -t nat -A OUTPUT -d 6.0.0.0/8 -p tcp -j REDIRECT --to-port 6   17:32:45
[sudo] password for dan: 

~/Documents/phantomsocks master !2 ?1 ❯ sudo iptables -t nat -L 
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
REDIRECT   tcp  --  anywhere             6.0.0.0/8            redir ports 6

Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination         

~/Documents/phantomsocks master !2 ?1 ❯ sudo ./phantomsocks -device wlan0 -dns :53 -vaddrprefix 6 -redir :6
Redirect: :6
DNS: :53
|
macronut commented 2 years ago

Have you changed the system's DNS or server in dnsmasq configuration to this DNS service? Linux requires change the DNS servers by yourself

ghost commented 2 years ago

I have done it according to your suggestion, but it happens with error like this and exits.

sudo ./phantomsocks -device wlan0 -dns 8.8.8.8:53 -vaddrprefix 6 -redir 0.0.0.0:6 -log 5
method=w-ack,w-time,w-md5
server=udp://8.8.8.8:53
ttl=15
method=ttl,w-ack,w-time,w-md5,w-seq,s-seg,https
method=ttl,w-ack,w-time,w-md5,w-seq,s-seg,https
method=ttl,mode2,https
default.conf
Redirect: 0.0.0.0:6
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x649d3d]

goroutine 18 [running]:
github.com/macronut/phantomsocks/phantomtcp.RedirectProxy({0x7570e8?, 0xc00009e008?})
        /home/gan/Documents/phantomsocks/phantomtcp/proxy.go:436 +0x13d
created by main.ListenAndServe
        /home/gan/Documents/phantomsocks/main.go:58 +0x9b

~/Documents/phantomsocks master !3 ?3 ❯ 
macronut commented 2 years ago

The code you are using is obsolete and it is not convenient to locate the problem.