MCPcopy Index your code
hub / github.com/perkeep/perkeep / Dial

Function Dial

pkg/client/android/androidx.go:227–254  ·  view source on GitHub ↗
(network, addr string)

Source from the content-addressed store, hash-verified

225}
226
227func Dial(network, addr string) (net.Conn, error) {
228 // Temporary laziness hack, avoiding doing a
229 // cross-compiled Android cgo build.
230 // Without cgo, package net uses
231 // /etc/resolv.conf (not available on
232 // Android). We really want a cgo binary to
233 // use Android's DNS cache, but it's kinda
234 // hard/impossible to cross-compile for now.
235 statTCPStart.Incr(1)
236 host, port, err := net.SplitHostPort(addr)
237 if err != nil {
238 statTCPFail.Incr(1)
239 return nil, fmt.Errorf("couldn't split %q", addr)
240 }
241 if OnAndroid() {
242 // Only do the Android DNS lookups when actually
243 // running on a device. We also run in "Android mode"
244 // (IsChild) in tests and interactive debugging.
245 host = androidLookupHost(host)
246 }
247 c, err := net.Dial(network, net.JoinHostPort(host, port))
248 if err != nil {
249 statTCPFail.Incr(1)
250 return nil, err
251 }
252 statTCPStarted.Incr(1)
253 return &statTrackingConn{Conn: c}, err
254}
255
256func TLSConfig() (*tls.Config, error) {
257 if !OnAndroid() {

Callers 2

DialFuncMethod · 0.92
DialTLSFuncMethod · 0.92

Calls 3

androidLookupHostFunction · 0.85
OnAndroidFunction · 0.70
IncrMethod · 0.45

Tested by

no test coverage detected