mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 09:25:41 +08:00
dnstun: remove dustun proxy, use dns and dnsserver settings instead
This commit is contained in:
parent
f6a578f849
commit
40f3315007
@ -23,7 +23,6 @@ Listen (local proxy server):
|
||||
- TCP tunnel
|
||||
- UDP tunnel
|
||||
- UDP over TCP tunnel
|
||||
- DNS Tunnel(udp2tcp)
|
||||
|
||||
Forward (local proxy client/upstream proxy server):
|
||||
- Socks5 proxy(tcp&udp)
|
||||
@ -131,10 +130,9 @@ Available Schemes:
|
||||
tcptun: tcp tunnel
|
||||
udptun: udp tunnel
|
||||
uottun: udp over tcp tunnel
|
||||
dnstun: listen on udp port and forward all dns requests to remote dns server via forwarders(tcp)
|
||||
|
||||
Available schemes for different modes:
|
||||
listen: mixed ss socks5 http redir tcptun udptun uottun dnstun
|
||||
listen: mixed ss socks5 http redir tcptun udptun uottun
|
||||
forward: ss socks5 http ssr vmess tls ws
|
||||
|
||||
SS scheme:
|
||||
@ -230,7 +228,7 @@ Examples:
|
||||
glider -listen socks5://:1080 -listen http://:8080 -forward ss://method:pass@1.1.1.1:8443
|
||||
-listen on :1080 as socks5 server, :8080 as http proxy server, forward all requests via remote ss server.
|
||||
|
||||
glider -listen redir://:1081 -listen dnstun://:53=8.8.8.8:53 -forward ss://method:pass@server1:port1,ss://method:pass@server2:port2
|
||||
glider -listen redir://:1081 -dns://:53 -dnsserver://8.8.8.8:53 -forward ss://method:pass@server1:port1,ss://method:pass@server2:port2
|
||||
-listen on :1081 as transparent redirect server, :53 as dns server, use forward chain: server1 -> server2.
|
||||
|
||||
glider -listen socks5://:1080 -forward ss://method:pass@server1:port1 -forward ss://method:pass@server2:port2 -strategy rr
|
||||
|
5
conf.go
5
conf.go
@ -170,11 +170,10 @@ func usage() {
|
||||
fmt.Fprintf(os.Stderr, " tcptun: tcp tunnel\n")
|
||||
fmt.Fprintf(os.Stderr, " udptun: udp tunnel\n")
|
||||
fmt.Fprintf(os.Stderr, " uottun: udp over tcp tunnel\n")
|
||||
fmt.Fprintf(os.Stderr, " dnstun: listen on udp port and forward all dns requests to remote dns server via forwarders(tcp)\n")
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
|
||||
fmt.Fprintf(os.Stderr, "Available schemes for different modes:\n")
|
||||
fmt.Fprintf(os.Stderr, " listen: mixed ss socks5 http redir tcptun udptun uottun dnstun\n")
|
||||
fmt.Fprintf(os.Stderr, " listen: mixed ss socks5 http redir tcptun udptun uottun\n")
|
||||
fmt.Fprintf(os.Stderr, " forward: ss socks5 http ssr vmess tls ws\n")
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
|
||||
@ -284,7 +283,7 @@ func usage() {
|
||||
fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -listen http://:8080 -forward ss://method:pass@1.1.1.1:8443\n")
|
||||
fmt.Fprintf(os.Stderr, " -listen on :1080 as socks5 server, :8080 as http proxy server, forward all requests via remote ss server.\n")
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -listen dnstun://:53=8.8.8.8:53 -forward ss://method:pass@server1:port1,ss://method:pass@server2:port2\n")
|
||||
fmt.Fprintf(os.Stderr, " "+app+" -listen redir://:1081 -dns://:53 -dnsserver://8.8.8.8:53 -forward ss://method:pass@server1:port1,ss://method:pass@server2:port2\n")
|
||||
fmt.Fprintf(os.Stderr, " -listen on :1081 as transparent redirect server, :53 as dns server, use forward chain: server1 -> server2.\n")
|
||||
fmt.Fprintf(os.Stderr, "\n")
|
||||
fmt.Fprintf(os.Stderr, " "+app+" -listen socks5://:1080 -forward ss://method:pass@server1:port1 -forward ss://method:pass@server2:port2 -strategy rr\n")
|
||||
|
@ -14,9 +14,6 @@ verbose
|
||||
# listen on 8443, serve as http/socks5 proxy on the same port.
|
||||
listen=:8443
|
||||
|
||||
# listen on udp port 5353, forward dns requests via tcp protocol
|
||||
listen=dnstun://:5353=8.8.8.8:53
|
||||
|
||||
# upstream forward proxy
|
||||
forward=socks5://192.168.1.10:1080
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
## 8. Transparent Proxy with dnsmasq
|
||||
|
||||
#### Setup a redirect proxy and a dnstunnel with glider
|
||||
#### Setup a redirect proxy and a dns server with glider
|
||||
glider.conf
|
||||
```bash
|
||||
verbose=True
|
||||
listen=redir://:1081
|
||||
listen=dnstun://:5353=8.8.8.8:53
|
||||
forward=http://forwarder1:8080,socks5://forwarder2:1080
|
||||
forward=http://1.1.1.1:8080
|
||||
dns=:5353
|
||||
dnsserver=8.8.8.8:53
|
||||
strategy=rr
|
||||
checkwebsite=www.apple.com
|
||||
checkduration=30
|
||||
|
@ -3,11 +3,14 @@
|
||||
verbose=True
|
||||
|
||||
listen=redir://:1081
|
||||
listen=dnstun://:5353=8.8.8.8:53
|
||||
|
||||
forward=http://forwarder1:8080,socks5://forwarder2:1080
|
||||
forward=http://1.1.1.1:8080
|
||||
|
||||
dns=:5353
|
||||
dnsserver=8.8.8.8:53
|
||||
|
||||
|
||||
strategy=rr
|
||||
checkwebsite=www.apple.com
|
||||
checkduration=30
|
||||
|
@ -55,12 +55,6 @@ listen=socks5://:1080
|
||||
# listen on 1084 as a udp over tcp tunnel, all requests to :1084 will be forward to 1.1.1.1:53
|
||||
# listen=uottun://:1084=1.1.1.1:53
|
||||
|
||||
# a dnstun is a special dns forwarder server with a fixed remote dns
|
||||
# listen on udp port 5353, act as a local dns server,
|
||||
# forward all requests to 8.8.8.8:53 via tcp protocol
|
||||
# listen=dnstun://:5353=8.8.8.8:53
|
||||
|
||||
|
||||
# FORWARDERS
|
||||
# ----------
|
||||
# Forwarders, we can setup multiple forwarders.
|
||||
|
3
main.go
3
main.go
@ -11,7 +11,6 @@ import (
|
||||
"github.com/nadoo/glider/dns"
|
||||
"github.com/nadoo/glider/proxy"
|
||||
|
||||
// _ "github.com/nadoo/glider/proxy/dnstun"
|
||||
_ "github.com/nadoo/glider/proxy/http"
|
||||
_ "github.com/nadoo/glider/proxy/mixed"
|
||||
_ "github.com/nadoo/glider/proxy/socks5"
|
||||
@ -26,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
// VERSION .
|
||||
const VERSION = "0.6.3"
|
||||
const VERSION = "0.6.5"
|
||||
|
||||
func dialerFromConf() proxy.Dialer {
|
||||
// global forwarders in xx.conf
|
||||
|
@ -1,64 +0,0 @@
|
||||
// https://tools.ietf.org/html/rfc1035
|
||||
|
||||
package dnstun
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/nadoo/glider/common/log"
|
||||
"github.com/nadoo/glider/dns"
|
||||
"github.com/nadoo/glider/proxy"
|
||||
"github.com/nadoo/glider/proxy/tcptun"
|
||||
)
|
||||
|
||||
// DNSTun struct
|
||||
type DNSTun struct {
|
||||
dialer proxy.Dialer
|
||||
addr string
|
||||
|
||||
raddr string
|
||||
|
||||
dns *dns.DNS
|
||||
tcp *tcptun.TCPTun
|
||||
}
|
||||
|
||||
func init() {
|
||||
proxy.RegisterServer("dnstun", NewDNSTunServer)
|
||||
}
|
||||
|
||||
// NewDNSTun returns a dns tunnel forwarder.
|
||||
func NewDNSTun(s string, dialer proxy.Dialer) (*DNSTun, error) {
|
||||
|
||||
u, err := url.Parse(s)
|
||||
if err != nil {
|
||||
log.F("parse err: %s", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
addr := u.Host
|
||||
d := strings.Split(addr, "=")
|
||||
addr, raddr := d[0], d[1]
|
||||
|
||||
p := &DNSTun{
|
||||
dialer: dialer,
|
||||
addr: addr,
|
||||
raddr: raddr,
|
||||
}
|
||||
|
||||
p.dns, _ = dns.NewDNS(addr, raddr, dialer, true)
|
||||
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// NewDNSTunServer returns a dns tunnel server.
|
||||
func NewDNSTunServer(s string, dialer proxy.Dialer) (proxy.Server, error) {
|
||||
return NewDNSTun(s, dialer)
|
||||
}
|
||||
|
||||
// ListenAndServe .
|
||||
func (s *DNSTun) ListenAndServe() {
|
||||
if s.dns != nil {
|
||||
go s.dns.ListenAndServe()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user