Merge "vlog: Change uses of "veyron"."
diff --git a/envutil/envutil.go b/envutil/envutil.go
new file mode 100644
index 0000000..7d1400a
--- /dev/null
+++ b/envutil/envutil.go
@@ -0,0 +1,28 @@
+package envutil
+
+import (
+ "fmt"
+ "os/exec"
+ "strings"
+)
+
+// Arch returns the architecture of the physical machine using
+// the "uname -m" command.
+func Arch() (string, error) {
+ out, err := exec.Command("uname", "-m").Output()
+ if err != nil {
+ return "", fmt.Errorf("'uname -m' command failed: %v", err)
+ }
+ machine := string(out)
+ arch := ""
+ if strings.Contains(machine, "x86_64") || strings.Contains(machine, "amd64") {
+ arch = "amd64"
+ } else if strings.HasSuffix(machine, "86") {
+ arch = "386"
+ } else if strings.Contains(machine, "arm") {
+ arch = "arm"
+ } else {
+ return "", fmt.Errorf("unknown architecture: %s", machine)
+ }
+ return arch, nil
+}
diff --git a/netstate/netstate.go b/netstate/netstate.go
index 70e45dc..7bb10bd 100644
--- a/netstate/netstate.go
+++ b/netstate/netstate.go
@@ -52,7 +52,7 @@
"net"
"strings"
- "v.io/v23/ipc"
+ "v.io/v23/rpc"
"v.io/x/lib/netconfig"
)
@@ -112,7 +112,7 @@
return nets
}
-type AddrList []ipc.Address
+type AddrList []rpc.Address
func (al AddrList) String() string {
r := ""
@@ -160,7 +160,7 @@
// AddressPredicate defines the function signature for predicate functions
// to be used with AddrList
-type AddressPredicate func(a ipc.Address) bool
+type AddressPredicate func(a rpc.Address) bool
// Filter returns all of the addresses for which the predicate
// function is true.
@@ -174,7 +174,7 @@
return r
}
-type Mapper func(a ipc.Address) ipc.Address
+type Mapper func(a rpc.Address) rpc.Address
// Map will apply the Mapper function to all of the items in its receiver
// and return a new AddrList containing all of the non-nil results from
@@ -189,10 +189,10 @@
return ral
}
-// ConvertToIPHost converts the network address component of an ipc.Address into
+// ConvertToIPHost converts the network address component of an rpc.Address into
// an instance with a net.Addr that contains an IP host address (as opposed to a
// network CIDR for example).
-func ConvertToIPHost(a ipc.Address) ipc.Address {
+func ConvertToIPHost(a rpc.Address) rpc.Address {
aifc, ok := a.(*AddrIfc)
if !ok {
return nil
@@ -201,10 +201,10 @@
return aifc
}
-// ConvertAccessibleIPHost converts the network address component of an ipc.Address
+// ConvertAccessibleIPHost converts the network address component of an rpc.Address
// into an instance with a net.Addr that contains an IP host address (as opposed to a
// network CIDR for example) with filtering out a loopback or non-accessible IPs.
-func ConvertAccessibleIPHost(a ipc.Address) ipc.Address {
+func ConvertAccessibleIPHost(a rpc.Address) rpc.Address {
if !IsAccessibleIP(a) {
return nil
}
@@ -257,7 +257,7 @@
}
// IsUnspecified returns true if its argument is an unspecified IP address
-func IsUnspecifiedIP(a ipc.Address) bool {
+func IsUnspecifiedIP(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil {
return ip.IsUnspecified()
}
@@ -265,7 +265,7 @@
}
// IsLoopback returns true if its argument is a loopback IP address
-func IsLoopbackIP(a ipc.Address) bool {
+func IsLoopbackIP(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && !ip.IsUnspecified() {
return ip.IsLoopback()
}
@@ -274,7 +274,7 @@
// IsAccessible returns true if its argument is an accessible (non-loopback)
// IP address.
-func IsAccessibleIP(a ipc.Address) bool {
+func IsAccessibleIP(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && !ip.IsUnspecified() {
return !ip.IsLoopback()
}
@@ -282,7 +282,7 @@
}
// IsUnicastIP returns true if its argument is a unicast IP address.
-func IsUnicastIP(a ipc.Address) bool {
+func IsUnicastIP(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && !ip.IsUnspecified() {
// ipv4 or v6
return !(ip.IsMulticast() || ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast())
@@ -291,7 +291,7 @@
}
// IsUnicastIPv4 returns true if its argument is a unicast IP4 address
-func IsUnicastIPv4(a ipc.Address) bool {
+func IsUnicastIPv4(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && ip.To4() != nil {
return !ip.IsUnspecified() && !ip.IsMulticast()
}
@@ -300,7 +300,7 @@
// IsPublicUnicastIPv4 returns true if its argument is a globally routable,
// public IPv4 unicast address.
-func IsPublicUnicastIPv4(a ipc.Address) bool {
+func IsPublicUnicastIPv4(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && !ip.IsUnspecified() {
if t := ip.To4(); t != nil && IsGloballyRoutableIP(t) {
return !ip.IsMulticast()
@@ -310,7 +310,7 @@
}
// IsUnicastIPv6 returns true if its argument is a unicast IPv6 address
-func IsUnicastIPv6(a ipc.Address) bool {
+func IsUnicastIPv6(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && ip.To4() == nil {
return !ip.IsUnspecified() && !(ip.IsLinkLocalMulticast() || ip.IsInterfaceLocalMulticast())
}
@@ -319,7 +319,7 @@
// IsUnicastIPv6 returns true if its argument is a globally routable IP6
// address
-func IsPublicUnicastIPv6(a ipc.Address) bool {
+func IsPublicUnicastIPv6(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil && ip.To4() == nil {
if t := ip.To16(); t != nil && IsGloballyRoutableIP(t) {
return true
@@ -330,7 +330,7 @@
// IsPublicUnicastIP returns true if its argument is a global routable IPv4
// or 6 address.
-func IsPublicUnicastIP(a ipc.Address) bool {
+func IsPublicUnicastIP(a rpc.Address) bool {
if ip := AsIP(a.Address()); ip != nil {
if t := ip.To4(); t != nil && IsGloballyRoutableIP(t) {
return true
diff --git a/netstate/netstate_test.go b/netstate/netstate_test.go
index 95a83a0..9939ae0 100644
--- a/netstate/netstate_test.go
+++ b/netstate/netstate_test.go
@@ -5,7 +5,7 @@
"reflect"
"testing"
- "v.io/v23/ipc"
+ "v.io/v23/rpc"
"v.io/x/lib/netconfig"
"v.io/x/lib/netstate"
@@ -114,7 +114,7 @@
}
cases := []struct {
- f func(a ipc.Address) bool
+ f func(a rpc.Address) bool
a string
r bool
}{
diff --git a/netstate/route.go b/netstate/route.go
index 6f487f3..8d35d83 100644
--- a/netstate/route.go
+++ b/netstate/route.go
@@ -5,7 +5,7 @@
"net"
"strings"
- "v.io/v23/ipc"
+ "v.io/v23/rpc"
"v.io/x/lib/netconfig"
)
@@ -81,7 +81,7 @@
// IsOnDefaultRoute returns true for addresses that are on an interface that
// has a default route set for the supplied address.
-func IsOnDefaultRoute(a ipc.Address) bool {
+func IsOnDefaultRoute(a rpc.Address) bool {
aifc, ok := a.(*AddrIfc)
if !ok || len(aifc.IPRoutes) == 0 {
return false
diff --git a/vlog/flags_test.go b/vlog/flags_test.go
index 8c2477f..d6c4a2f 100644
--- a/vlog/flags_test.go
+++ b/vlog/flags_test.go
@@ -42,7 +42,7 @@
}
func TestFlags(t *testing.T) {
- sh, err := modules.NewShell(nil, nil)
+ sh, err := modules.NewShell(nil, nil, testing.Verbose(), t)
if err != nil {
t.Fatalf("unexpected error: %s", err)
}