func getprotobyname(name string) (proto int, err error) { p, err := syscall.GetProtoByName(name) if err != nil { return 0, os.NewSyscallError("GetProtoByName", err) } return int(p.Proto), nil }
// lookupProtocol looks up IP protocol name and returns correspondent protocol number. func lookupProtocol(name string) (proto int, err error) { protoentLock.Lock() defer protoentLock.Unlock() p, e := syscall.GetProtoByName(name) if e != 0 { return 0, os.NewSyscallError("GetProtoByName", e) } return int(p.Proto), nil }