Source File
per_host.go
Belonging Package
golang.org/x/net/proxy
package proxy
import (
)
type PerHost struct {
def, bypass Dialer
bypassNetworks []*net.IPNet
bypassIPs []net.IP
bypassZones []string
bypassHosts []string
}
func ( *PerHost) ( context.Context, , string) ( net.Conn, error) {
, , := net.SplitHostPort()
if != nil {
return nil,
}
:= .dialerForRequest()
if , := .(ContextDialer); {
return .DialContext(, , )
}
return dialContext(, , , )
}
func ( *PerHost) ( string) Dialer {
if := net.ParseIP(); != nil {
for , := range .bypassNetworks {
if .Contains() {
return .bypass
}
}
for , := range .bypassIPs {
if .Equal() {
return .bypass
}
}
return .def
}
for , := range .bypassZones {
if strings.HasSuffix(, ) {
return .bypass
}
return .bypass
}
}
for , := range .bypassHosts {
if == {
return .bypass
}
}
return .def
}
func ( *PerHost) ( *net.IPNet) {
.bypassNetworks = append(.bypassNetworks, )
}
func ( *PerHost) ( string) {
if strings.HasSuffix(, ".") {
= [:len()-1]
}
if !strings.HasPrefix(, ".") {
= "." +
}
.bypassZones = append(.bypassZones, )
}
func ( *PerHost) ( string) {
if strings.HasSuffix(, ".") {
= [:len()-1]
}
.bypassHosts = append(.bypassHosts, )
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |