// Basic networking.
// Because net must be used by any package that wants to
- // do networking portably, it must have a small dependency set: just L1+basic os.
- "net": {"L1", "CGO", "os", "syscall", "time", "internal/syscall/windows", "internal/singleflight"},
+ // do networking portably, it must have a small dependency set: just L0+basic os.
+ "net": {"L0", "CGO", "math/rand", "os", "sort", "syscall", "time", "internal/syscall/windows", "internal/singleflight"},
// NET enables use of basic network-related packages.
"NET": {
import (
"os"
"runtime"
- "strconv"
"sync"
"syscall"
)
return
}
if '0' <= s[0] && s[0] <= '9' {
- debugLevel, _ = strconv.Atoi(s)
+ debugLevel, _, _ = dtoi(s, 0)
} else {
dnsMode = s
}
"io"
"math/rand"
"os"
- "strconv"
"sync"
"time"
)
if s, ok := lookupOrderName[o]; ok {
return s
}
- return "hostLookupOrder=" + strconv.Itoa(int(o)) + "??"
+ return "hostLookupOrder=" + itoa(int(o)) + "??"
}
// goLookupHost is the native Go implementation of LookupHost.
"reflect"
"regexp"
"sort"
- "strconv"
"strings"
"testing"
)
// golang.org mail exchanger = 2 alt1.aspmx.l.google.com.
rx := regexp.MustCompile(`(?m)^([a-z0-9.\-]+)\s+mail exchanger\s*=\s*([0-9]+)\s*([a-z0-9.\-]+)$`)
for _, ans := range rx.FindAllStringSubmatch(r, -1) {
- pref, _ := strconv.Atoi(ans[2])
+ pref, _, _ := dtoi(ans[2], 0)
mx = append(mx, &MX{fqdn(ans[3]), uint16(pref)})
}
// windows nslookup syntax
// gmail.com MX preference = 30, mail exchanger = alt3.gmail-smtp-in.l.google.com
rx = regexp.MustCompile(`(?m)^([a-z0-9.\-]+)\s+MX preference\s*=\s*([0-9]+)\s*,\s*mail exchanger\s*=\s*([a-z0-9.\-]+)$`)
for _, ans := range rx.FindAllStringSubmatch(r, -1) {
- pref, _ := strconv.Atoi(ans[2])
+ pref, _, _ := dtoi(ans[2], 0)
mx = append(mx, &MX{fqdn(ans[3]), uint16(pref)})
}
return
package net
import (
- "strconv"
"time"
)
// Set keep alive period.
func setKeepAlivePeriod(fd *netFD, d time.Duration) error {
- cmd := "keepalive " + strconv.Itoa(int(d/time.Millisecond))
+ cmd := "keepalive " + itoa(int(d/time.Millisecond))
_, e := fd.ctl.WriteAt([]byte(cmd), 0)
return e
}