mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
proxy: add new env: FORWARDER_URL to script health check (#310)
This commit is contained in:
1 parent
fac4b86f60
commit
9b2f00f4c8
7 files changed
+21
-15
No files matched your search
+7
-1
@@ -18,6 +18,7 @@ type StatusHandler func(*Forwarder)
|
||||
// Forwarder associates with a `-forward` command, usually a dialer or a chain of dialers.
|
||||
type Forwarder struct {
|
||||
proxy.Dialer
|
||||
url string
|
||||
addr string
|
||||
priority uint32
|
||||
maxFailures uint32 // maxfailures to set to Disabled
|
||||
@@ -30,7 +31,7 @@ type Forwarder struct {
|
||||
|
||||
// ForwarderFromURL parses `forward=` command value and returns a new forwarder.
|
||||
func ForwarderFromURL(s, intface string, dialTimeout, relayTimeout time.Duration) (f *Forwarder, err error) {
|
||||
f = &Forwarder{}
|
||||
f = &Forwarder{url: s}
|
||||
|
||||
ss := strings.Split(s, "#")
|
||||
if len(ss) > 1 {
|
||||
@@ -107,6 +108,11 @@ func (f *Forwarder) Addr() string {
|
||||
return f.addr
|
||||
}
|
||||
|
||||
// URL returns the forwarder's full url.
|
||||
func (f *Forwarder) URL() string {
|
||||
return f.url
|
||||
}
|
||||
|
||||
// Dial dials to addr and returns conn.
|
||||
func (f *Forwarder) Dial(network, addr string) (c net.Conn, err error) {
|
||||
c, err = f.Dialer.Dial(network, addr)
|
||||
|
||||
Reference in new issue
Block a user