Merge "ref/runtime/internal/stream/manager: Prevent lingering goroutine."
diff --git a/cmd/mounttable/impl_test.go b/cmd/mounttable/impl_test.go
index 09875f3..fad262e 100644
--- a/cmd/mounttable/impl_test.go
+++ b/cmd/mounttable/impl_test.go
@@ -36,7 +36,9 @@
}
func deadline(minutes int) vdltime.Deadline {
- return vdltime.Deadline{now.Add(time.Minute * time.Duration(minutes))}
+ return vdltime.Deadline{
+ Time: now.Add(time.Minute * time.Duration(minutes)),
+ }
}
type server struct {
@@ -46,8 +48,22 @@
func (s *server) Glob__(ctx *context.T, call rpc.GlobServerCall, g *glob.Glob) error {
ctx.VI(2).Infof("Glob() was called. suffix=%v pattern=%q", s.suffix, g.String())
sender := call.SendStream()
- sender.Send(naming.GlobReplyEntry{naming.MountEntry{"name1", []naming.MountedServer{{"server1", deadline(1)}}, false, false}})
- sender.Send(naming.GlobReplyEntry{naming.MountEntry{"name2", []naming.MountedServer{{"server2", deadline(2)}, {"server3", deadline(3)}}, false, false}})
+ sender.Send(naming.GlobReplyEntry{
+ Value: naming.MountEntry{
+ Name: "name1",
+ Servers: []naming.MountedServer{{"server1", deadline(1)}},
+ ServesMountTable: false,
+ IsLeaf: false,
+ },
+ })
+ sender.Send(naming.GlobReplyEntry{
+ Value: naming.MountEntry{
+ Name: "name2",
+ Servers: []naming.MountedServer{{"server2", deadline(2)}, {"server3", deadline(3)}},
+ ServesMountTable: false,
+ IsLeaf: false,
+ },
+ })
return nil
}
diff --git a/cmd/principal/bless.go b/cmd/principal/bless.go
index ca6c46c..2c24366 100644
--- a/cmd/principal/bless.go
+++ b/cmd/principal/bless.go
@@ -36,7 +36,9 @@
// Authorize the server by its public key (obtained from macaroonChan).
// Must skip authorization during name resolution because the identity
// service is not a trusted root yet.
- blessings, err := identity.MacaroonBlesserClient(service).Bless(ctx, macaroon, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{serviceKey})
+ blessings, err := identity.MacaroonBlesserClient(service).Bless(ctx, macaroon, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{
+ PublicKey: serviceKey,
+ })
if err != nil {
return security.Blessings{}, fmt.Errorf("failed to get blessing from %q: %v", service, err)
}
diff --git a/cmd/vdl/arith_test.go b/cmd/vdl/arith_test.go
index d0294ae..8cb78b7 100644
--- a/cmd/vdl/arith_test.go
+++ b/cmd/vdl/arith_test.go
@@ -309,14 +309,14 @@
if q != 2 || r != 1 {
t.Errorf("DivMod: expected (2,1) got (%d,%d)", q, r)
}
- diff, err := ar.Sub(ctx, base.Args{7, 8})
+ diff, err := ar.Sub(ctx, base.Args{A: 7, B: 8})
if err != nil {
t.Errorf("Sub: got %q but expected no error", err)
}
if diff != -1 {
t.Errorf("Sub: got %d, expected -1", diff)
}
- prod, err := ar.Mul(ctx, base.NestedArgs{base.Args{7, 8}})
+ prod, err := ar.Mul(ctx, base.NestedArgs{Args: base.Args{A: 7, B: 8}})
if err != nil {
t.Errorf("Mul: got %q, but expected no error", err)
}
diff --git a/envvar.go b/envvar.go
index 31ca4bb..bb7af0a 100644
--- a/envvar.go
+++ b/envvar.go
@@ -24,12 +24,20 @@
// See v.io/x/ref/lib/security.CreatePersistentPrincipal.
EnvCredentials = "V23_CREDENTIALS"
+ // EnvAgentPath is the name of the environment variable pointing to an
+ // agentd process containing all the credentials a principal (the blessing
+ // store, the blessing roots, possibly the private key etc.).
+ //
+ // Typically only one of EnvCredentials or EnvAgentPaths will be set in a
+ // process. If both are set, then EnvCredentials takes preference.
+ EnvAgentPath = "V23_AGENT_PATH"
+
// EnvAgentEndpoint is the name of the environment variable pointing to an
// agentd process containing all the credentials a principal (the blessing
// store, the blessing roots, possibly the private key etc.).
//
- // Typically only one of EnvCredentials or EnvAgentEndpoint will be set in a
- // process. If both are set, then EnvCredentials takes preference.
+ // EnvAgentEndpoint is deprecated. New agentd processes should use EnvAgentPath.
+ // If both are set, EnvAgentPath takes preference.
EnvAgentEndpoint = "V23_AGENT_ENDPOINT"
// EnvNamespacePrefix is the prefix of all environment variables that define a
diff --git a/examples/rps/rpsbot/player.go b/examples/rps/rpsbot/player.go
index 31ad9b0..592ffcb 100644
--- a/examples/rps/rpsbot/player.go
+++ b/examples/rps/rpsbot/player.go
@@ -131,7 +131,7 @@
opts := v.Value
n := rand.Intn(len(opts))
outer.VI(1).Infof("My turn to play. Picked %q from %v", opts[n], opts)
- if err := sender.Send(rps.PlayerActionMove{opts[n]}); err != nil {
+ if err := sender.Send(rps.PlayerActionMove{Value: opts[n]}); err != nil {
return rps.PlayResult{}, err
}
case rps.JudgeActionRoundResult:
diff --git a/examples/rps/rpsplayer/main.go b/examples/rps/rpsplayer/main.go
index 3f496f5..ad57b4f 100644
--- a/examples/rps/rpsplayer/main.go
+++ b/examples/rps/rpsplayer/main.go
@@ -243,7 +243,7 @@
fmt.Println()
fmt.Println("Choose your weapon:")
m := selectOne(opts)
- if err := game.SendStream().Send(rps.PlayerActionMove{opts[m]}); err != nil {
+ if err := game.SendStream().Send(rps.PlayerActionMove{Value: opts[m]}); err != nil {
return rps.PlayResult{}, err
}
case rps.JudgeActionScore:
diff --git a/examples/tunnel/vsh/iomanager.go b/examples/tunnel/vsh/iomanager.go
index d0f6d95..4682d94 100644
--- a/examples/tunnel/vsh/iomanager.go
+++ b/examples/tunnel/vsh/iomanager.go
@@ -130,7 +130,10 @@
logger.Global().Infof("GetWindowSize failed: %v", err)
continue
}
- outchan <- tunnel.ClientShellPacketWinSize{tunnel.WindowSize{ws.Row, ws.Col}}
+ outchan <- tunnel.ClientShellPacketWinSize{tunnel.WindowSize{
+ Rows: ws.Row,
+ Cols: ws.Col,
+ }}
}
}
diff --git a/lib/exec/exec_test.go b/lib/exec/exec_test.go
index 259b4a7..6426f8c 100644
--- a/lib/exec/exec_test.go
+++ b/lib/exec/exec_test.go
@@ -119,7 +119,7 @@
stderr, _ := cmd.StderrPipe()
cfg := vexec.NewConfig()
cfg.Set("foo", "bar")
- ph := vexec.NewParentHandle(cmd, vexec.ConfigOpt{cfg})
+ ph := vexec.NewParentHandle(cmd, vexec.ConfigOpt{Config: cfg})
err := ph.Start()
if err != nil {
t.Fatalf("testConfig: start: %v", err)
@@ -213,7 +213,7 @@
cmd[i].ExtraFiles = append(cmd[i].ExtraFiles, controlRead)
stderr[i], _ = cmd[i].StderrPipe()
tk := timekeeper.NewManualTime()
- ph[i] = vexec.NewParentHandle(cmd[i], vexec.TimeKeeperOpt{tk})
+ ph[i] = vexec.NewParentHandle(cmd[i], vexec.TimeKeeperOpt{TimeKeeper: tk})
done.Add(1)
go func() {
// For simulated slow children, wait until the parent
@@ -311,7 +311,7 @@
cmd.ExtraFiles = append(cmd.ExtraFiles, controlRead)
stderr, _ := cmd.StderrPipe()
tk := timekeeper.NewManualTime()
- ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{tk})
+ ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{TimeKeeper: tk})
defer clean(t, ph)
defer controlWrite.Close()
defer controlRead.Close()
@@ -352,7 +352,7 @@
t.Fatalf("%s: failed to get stderr pipe", name)
}
tk := timekeeper.NewManualTime()
- ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{tk})
+ ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{TimeKeeper: tk})
defer clean(t, ph)
defer controlWrite.Close()
defer controlRead.Close()
@@ -422,7 +422,7 @@
name := "exitEarly"
cmd := helperCommand(name)
tk := timekeeper.NewManualTime()
- ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{tk})
+ ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{TimeKeeper: tk})
err := ph.Start()
if err != nil {
t.Fatalf("%s: start: %v", name, err)
@@ -438,7 +438,7 @@
name := "testReadyAndHang"
cmd := helperCommand(name)
tk := timekeeper.NewManualTime()
- ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{tk})
+ ph := vexec.NewParentHandle(cmd, vexec.TimeKeeperOpt{TimeKeeper: tk})
if err := waitForReady(t, cmd, name, 1, ph); err != nil {
t.Errorf("%s: WaitForReady: %v (%v)", name, err, ph)
}
diff --git a/lib/mgmt/model.go b/lib/mgmt/model.go
index 1aa425f..95a667f 100644
--- a/lib/mgmt/model.go
+++ b/lib/mgmt/model.go
@@ -13,6 +13,7 @@
ProtocolConfigKey = "MGMT_CHILD_PROCESS_PROTOCOL"
ParentBlessingConfigKey = "MGMT_PARENT_BLESSING_PEER_PATTERN"
SecurityAgentEndpointConfigKey = "MGMT_SECURITY_AGENT_EP"
+ SecurityAgentPathConfigKey = "MGMT_SECURITY_AGENT_PATH"
AppOriginConfigKey = "MGMT_APP_ORIGIN"
PublisherBlessingPrefixesKey = "MGMT_PUBLISHER_BLESSING_PREFIXES"
InstanceNameKey = "MGMT_INSTANCE_NAME"
diff --git a/lib/pubsub/config_test.go b/lib/pubsub/config_test.go
index f827c79..c434606 100644
--- a/lib/pubsub/config_test.go
+++ b/lib/pubsub/config_test.go
@@ -149,7 +149,11 @@
}
}
- got, want := pub.Latest("s2"), &pubsub.Stream{"s2", "eg2", nil}
+ got, want := pub.Latest("s2"), &pubsub.Stream{
+ Name: "s2",
+ Description: "eg2",
+ Latest: nil,
+ }
if !reflect.DeepEqual(got, want) {
t.Errorf("got %q, want %q", got, want)
}
diff --git a/lib/stats/sysstats/sysstats.go b/lib/stats/sysstats/sysstats.go
index 2fafa14..98c52d1 100644
--- a/lib/stats/sysstats/sysstats.go
+++ b/lib/stats/sysstats/sysstats.go
@@ -40,7 +40,10 @@
var kv []stats.KeyValue
for _, v := range os.Environ() {
if parts := strings.SplitN(v, "=", 2); len(parts) == 2 {
- kv = append(kv, stats.KeyValue{parts[0], parts[1]})
+ kv = append(kv, stats.KeyValue{
+ Key: parts[0],
+ Value: parts[1],
+ })
}
}
stats.NewMap("system/environ").Set(kv)
@@ -66,7 +69,10 @@
v := reflect.ValueOf(memstats)
kv := make([]stats.KeyValue, len(fieldNames))
for i, name := range fieldNames {
- kv[i] = stats.KeyValue{name, v.FieldByName(name).Interface()}
+ kv[i] = stats.KeyValue{
+ Key: name,
+ Value: v.FieldByName(name).Interface(),
+ }
}
mstats.Set(kv)
}
@@ -83,7 +89,10 @@
func exportMetaData() {
var kv []stats.KeyValue
for id, value := range metadata.ToMap() {
- kv = append(kv, stats.KeyValue{id, value})
+ kv = append(kv, stats.KeyValue{
+ Key: id,
+ Value: value,
+ })
}
stats.NewMap("system/metadata").Set(kv)
}
diff --git a/lib/vdl/build/build_test.go b/lib/vdl/build/build_test.go
index f3c4414..38773a1 100644
--- a/lib/vdl/build/build_test.go
+++ b/lib/vdl/build/build_test.go
@@ -579,7 +579,15 @@
func TestBuildExprs(t *testing.T) {
ttArray := vdl.ArrayType(2, vdl.Int32Type)
- ttStruct := vdl.StructType(vdl.Field{"A", vdl.Int32Type}, vdl.Field{"B", vdl.StringType})
+ ttStruct := vdl.StructType(
+ vdl.Field{
+ Name: "A",
+ Type: vdl.Int32Type,
+ }, vdl.Field{
+ Name: "B",
+ Type: vdl.StringType,
+ },
+ )
vvArray := vdl.ZeroValue(ttArray)
vvArray.Index(0).AssignInt(1)
vvArray.Index(1).AssignInt(-2)
diff --git a/lib/vdl/codegen/golang/type_test.go b/lib/vdl/codegen/golang/type_test.go
index 4a650c8..fe2e20e 100644
--- a/lib/vdl/codegen/golang/type_test.go
+++ b/lib/vdl/codegen/golang/type_test.go
@@ -180,11 +180,23 @@
tSet = vdl.SetType(vdl.StringType)
tMap = vdl.MapType(vdl.StringType, vdl.Int64Type)
tStruct = vdl.NamedType("TestStruct", vdl.StructType(
- vdl.Field{"A", vdl.StringType},
- vdl.Field{"B", vdl.Int64Type},
+ vdl.Field{
+ Name: "A",
+ Type: vdl.StringType,
+ },
+ vdl.Field{
+ Name: "B",
+ Type: vdl.Int64Type,
+ },
))
tUnion = vdl.NamedType("TestUnion", vdl.UnionType(
- vdl.Field{"A", vdl.StringType},
- vdl.Field{"B", vdl.Int64Type},
+ vdl.Field{
+ Name: "A",
+ Type: vdl.StringType,
+ },
+ vdl.Field{
+ Name: "B",
+ Type: vdl.Int64Type,
+ },
))
)
diff --git a/lib/vdl/compile/const_test.go b/lib/vdl/compile/const_test.go
index a3c0d20..2419f86 100644
--- a/lib/vdl/compile/const_test.go
+++ b/lib/vdl/compile/const_test.go
@@ -183,7 +183,10 @@
}
func makeStructTypeObjectType(name string) *vdl.Type {
- return vdl.NamedType(name, vdl.StructType(vdl.Field{"T", vdl.TypeObjectType}))
+ return vdl.NamedType(name, vdl.StructType(vdl.Field{
+ Name: "T",
+ Type: vdl.TypeObjectType,
+ }))
}
func makeStructTypeObject(name string, t *vdl.Type) *vdl.Value {
@@ -196,7 +199,10 @@
tA := vdl.NamedType("p.kg/a.A", vdl.StructType([]vdl.Field{
{"X", vdl.Int64Type}, {"Y", vdl.StringType},
}...))
- tB := vdl.NamedType("p.kg/a.B", vdl.StructType(vdl.Field{"Z", vdl.ListType(tA)}))
+ tB := vdl.NamedType("p.kg/a.B", vdl.StructType(vdl.Field{
+ Name: "Z",
+ Type: vdl.ListType(tA),
+ }))
res := vdl.ZeroValue(tB)
listv := res.StructField(0).AssignLen(2)
listv.Index(0).StructField(0).AssignInt(1)
@@ -213,7 +219,10 @@
func makeInnerEnum(label string) *vdl.Value {
tA := vdl.NamedType("p.kg/a.A", vdl.EnumType("X", "Y", "Z"))
- tB := vdl.NamedType("p.kg/a.B", vdl.StructType(vdl.Field{"A", tA}))
+ tB := vdl.NamedType("p.kg/a.B", vdl.StructType(vdl.Field{
+ Name: "A",
+ Type: tA,
+ }))
res := vdl.ZeroValue(tB)
res.StructField(0).AssignEnumLabel(label)
return res
diff --git a/lib/vdl/compile/type_test.go b/lib/vdl/compile/type_test.go
index 0009a5d..1c43299 100644
--- a/lib/vdl/compile/type_test.go
+++ b/lib/vdl/compile/type_test.go
@@ -126,7 +126,10 @@
{"Map", tp{{"a", `type Res map[int32]string`, vdl.MapType(vdl.Int32Type, vdl.StringType), ""}}},
{"Struct", tp{{"a", `type Res struct{A int32;B string}`, vdl.StructType([]vdl.Field{{"A", vdl.Int32Type}, {"B", vdl.StringType}}...), ""}}},
{"Union", tp{{"a", `type Res union{A bool;B int32;C string}`, vdl.UnionType([]vdl.Field{{"A", vdl.BoolType}, {"B", vdl.Int32Type}, {"C", vdl.StringType}}...), ""}}},
- {"Optional", tp{{"a", `type Res []?x;type x struct{A bool}`, vdl.ListType(vdl.OptionalType(namedX(vdl.StructType(vdl.Field{"A", vdl.BoolType})))), ""}}},
+ {"Optional", tp{{"a", `type Res []?x;type x struct{A bool}`, vdl.ListType(vdl.OptionalType(namedX(vdl.StructType(vdl.Field{
+ Name: "A",
+ Type: vdl.BoolType,
+ })))), ""}}},
// Test named types based on named types.
{"NBool", tp{{"a", `type Res x;type x bool`, namedX(vdl.BoolType), ""}}},
diff --git a/lib/vdl/opconst/testutil_test.go b/lib/vdl/opconst/testutil_test.go
index e16b636..886e83e 100644
--- a/lib/vdl/opconst/testutil_test.go
+++ b/lib/vdl/opconst/testutil_test.go
@@ -311,10 +311,10 @@
setStringTypeN = vdl.NamedType("nSetString", vdl.SetType(stringTypeN))
mapStringBoolType = vdl.MapType(vdl.StringType, vdl.BoolType)
mapStringBoolTypeN = vdl.NamedType("nMapStringBool", vdl.MapType(stringTypeN, boolTypeN))
- structXYZBoolType = vdl.StructType(vdl.Field{"X", vdl.BoolType}, vdl.Field{"Y", vdl.BoolType}, vdl.Field{"Z", vdl.BoolType})
- structXYZBoolTypeN = vdl.NamedType("nStructXYZBool", vdl.StructType(vdl.Field{"X", boolTypeN}, vdl.Field{"Y", boolTypeN}, vdl.Field{"Z", boolTypeN}))
- structWXBoolType = vdl.StructType(vdl.Field{"W", vdl.BoolType}, vdl.Field{"X", vdl.BoolType})
- structWXBoolTypeN = vdl.NamedType("nStructWXBool", vdl.StructType(vdl.Field{"W", boolTypeN}, vdl.Field{"X", boolTypeN}))
+ structXYZBoolType = vdl.StructType(vdl.Field{Name: "X", Type: vdl.BoolType}, vdl.Field{Name: "Y", Type: vdl.BoolType}, vdl.Field{Name: "Z", Type: vdl.BoolType})
+ structXYZBoolTypeN = vdl.NamedType("nStructXYZBool", vdl.StructType(vdl.Field{Name: "X", Type: boolTypeN}, vdl.Field{Name: "Y", Type: boolTypeN}, vdl.Field{Name: "Z", Type: boolTypeN}))
+ structWXBoolType = vdl.StructType(vdl.Field{Name: "W", Type: vdl.BoolType}, vdl.Field{Name: "X", Type: vdl.BoolType})
+ structWXBoolTypeN = vdl.NamedType("nStructWXBool", vdl.StructType(vdl.Field{Name: "W", Type: boolTypeN}, vdl.Field{Name: "X", Type: boolTypeN}))
// Composite types representing maps of strings to numbers.
mapStringUint64Type = vdl.MapType(vdl.StringType, vdl.Uint64Type)
mapStringUint64TypeN = vdl.NamedType("nMapStringUint64", vdl.MapType(stringTypeN, uint64TypeN))
@@ -324,24 +324,24 @@
mapStringFloat64TypeN = vdl.NamedType("nMapStringFloat64", vdl.MapType(stringTypeN, float64TypeN))
mapStringComplex64Type = vdl.MapType(vdl.StringType, vdl.Complex64Type)
mapStringComplex64TypeN = vdl.NamedType("nMapStringComplex64", vdl.MapType(stringTypeN, complex64TypeN))
- structVWXUint64Type = vdl.StructType(vdl.Field{"V", vdl.Uint64Type}, vdl.Field{"W", vdl.Uint64Type}, vdl.Field{"X", vdl.Uint64Type})
- structVWXUint64TypeN = vdl.NamedType("nStructVWXUint64", vdl.StructType(vdl.Field{"V", uint64TypeN}, vdl.Field{"W", uint64TypeN}, vdl.Field{"X", uint64TypeN}))
- structVWXInt64Type = vdl.StructType(vdl.Field{"V", vdl.Int64Type}, vdl.Field{"W", vdl.Int64Type}, vdl.Field{"X", vdl.Int64Type})
- structVWXInt64TypeN = vdl.NamedType("nStructVWXInt64", vdl.StructType(vdl.Field{"V", int64TypeN}, vdl.Field{"W", int64TypeN}, vdl.Field{"X", int64TypeN}))
- structVWXFloat64Type = vdl.StructType(vdl.Field{"V", vdl.Float64Type}, vdl.Field{"W", vdl.Float64Type}, vdl.Field{"X", vdl.Float64Type})
- structVWXFloat64TypeN = vdl.NamedType("nStructVWXFloat64", vdl.StructType(vdl.Field{"V", float64TypeN}, vdl.Field{"W", float64TypeN}, vdl.Field{"X", float64TypeN}))
- structVWXComplex64Type = vdl.StructType(vdl.Field{"V", vdl.Complex64Type}, vdl.Field{"W", vdl.Complex64Type}, vdl.Field{"X", vdl.Complex64Type})
- structVWXComplex64TypeN = vdl.NamedType("nStructVWXComplex64", vdl.StructType(vdl.Field{"V", complex64TypeN}, vdl.Field{"W", complex64TypeN}, vdl.Field{"X", complex64TypeN}))
- structUVUint64Type = vdl.StructType(vdl.Field{"U", vdl.Uint64Type}, vdl.Field{"V", vdl.Uint64Type})
- structUVUint64TypeN = vdl.NamedType("nStructUVUint64", vdl.StructType(vdl.Field{"U", uint64TypeN}, vdl.Field{"V", uint64TypeN}))
- structUVInt64Type = vdl.StructType(vdl.Field{"U", vdl.Int64Type}, vdl.Field{"V", vdl.Int64Type})
- structUVInt64TypeN = vdl.NamedType("nStructUVInt64", vdl.StructType(vdl.Field{"U", int64TypeN}, vdl.Field{"V", int64TypeN}))
- structUVFloat64Type = vdl.StructType(vdl.Field{"U", vdl.Float64Type}, vdl.Field{"V", vdl.Float64Type})
- structUVFloat64TypeN = vdl.NamedType("nStructUVFloat64", vdl.StructType(vdl.Field{"U", float64TypeN}, vdl.Field{"V", float64TypeN}))
- structUVComplex64Type = vdl.StructType(vdl.Field{"U", vdl.Complex64Type}, vdl.Field{"V", vdl.Complex64Type})
- structUVComplex64TypeN = vdl.NamedType("nStructUVComplex64", vdl.StructType(vdl.Field{"U", complex64TypeN}, vdl.Field{"V", complex64TypeN}))
+ structVWXUint64Type = vdl.StructType(vdl.Field{Name: "V", Type: vdl.Uint64Type}, vdl.Field{Name: "W", Type: vdl.Uint64Type}, vdl.Field{Name: "X", Type: vdl.Uint64Type})
+ structVWXUint64TypeN = vdl.NamedType("nStructVWXUint64", vdl.StructType(vdl.Field{Name: "V", Type: uint64TypeN}, vdl.Field{Name: "W", Type: uint64TypeN}, vdl.Field{Name: "X", Type: uint64TypeN}))
+ structVWXInt64Type = vdl.StructType(vdl.Field{Name: "V", Type: vdl.Int64Type}, vdl.Field{Name: "W", Type: vdl.Int64Type}, vdl.Field{Name: "X", Type: vdl.Int64Type})
+ structVWXInt64TypeN = vdl.NamedType("nStructVWXInt64", vdl.StructType(vdl.Field{Name: "V", Type: int64TypeN}, vdl.Field{Name: "W", Type: int64TypeN}, vdl.Field{Name: "X", Type: int64TypeN}))
+ structVWXFloat64Type = vdl.StructType(vdl.Field{Name: "V", Type: vdl.Float64Type}, vdl.Field{Name: "W", Type: vdl.Float64Type}, vdl.Field{Name: "X", Type: vdl.Float64Type})
+ structVWXFloat64TypeN = vdl.NamedType("nStructVWXFloat64", vdl.StructType(vdl.Field{Name: "V", Type: float64TypeN}, vdl.Field{Name: "W", Type: float64TypeN}, vdl.Field{Name: "X", Type: float64TypeN}))
+ structVWXComplex64Type = vdl.StructType(vdl.Field{Name: "V", Type: vdl.Complex64Type}, vdl.Field{Name: "W", Type: vdl.Complex64Type}, vdl.Field{Name: "X", Type: vdl.Complex64Type})
+ structVWXComplex64TypeN = vdl.NamedType("nStructVWXComplex64", vdl.StructType(vdl.Field{Name: "V", Type: complex64TypeN}, vdl.Field{Name: "W", Type: complex64TypeN}, vdl.Field{Name: "X", Type: complex64TypeN}))
+ structUVUint64Type = vdl.StructType(vdl.Field{Name: "U", Type: vdl.Uint64Type}, vdl.Field{Name: "V", Type: vdl.Uint64Type})
+ structUVUint64TypeN = vdl.NamedType("nStructUVUint64", vdl.StructType(vdl.Field{Name: "U", Type: uint64TypeN}, vdl.Field{Name: "V", Type: uint64TypeN}))
+ structUVInt64Type = vdl.StructType(vdl.Field{Name: "U", Type: vdl.Int64Type}, vdl.Field{Name: "V", Type: vdl.Int64Type})
+ structUVInt64TypeN = vdl.NamedType("nStructUVInt64", vdl.StructType(vdl.Field{Name: "U", Type: int64TypeN}, vdl.Field{Name: "V", Type: int64TypeN}))
+ structUVFloat64Type = vdl.StructType(vdl.Field{Name: "U", Type: vdl.Float64Type}, vdl.Field{Name: "V", Type: vdl.Float64Type})
+ structUVFloat64TypeN = vdl.NamedType("nStructUVFloat64", vdl.StructType(vdl.Field{Name: "U", Type: float64TypeN}, vdl.Field{Name: "V", Type: float64TypeN}))
+ structUVComplex64Type = vdl.StructType(vdl.Field{Name: "U", Type: vdl.Complex64Type}, vdl.Field{Name: "V", Type: vdl.Complex64Type})
+ structUVComplex64TypeN = vdl.NamedType("nStructUVComplex64", vdl.StructType(vdl.Field{Name: "U", Type: complex64TypeN}, vdl.Field{Name: "V", Type: complex64TypeN}))
- structAIntType = vdl.StructType(vdl.Field{"A", vdl.Int64Type})
+ structAIntType = vdl.StructType(vdl.Field{Name: "A", Type: vdl.Int64Type})
structAIntTypeN = vdl.NamedType("nStructA", structAIntType)
// Types that cannot be converted to sets. Although we represent sets as
@@ -351,8 +351,8 @@
emptyTypeN = vdl.NamedType("nEmpty", vdl.StructType())
mapStringEmptyType = vdl.MapType(vdl.StringType, emptyType)
mapStringEmptyTypeN = vdl.NamedType("nMapStringEmpty", vdl.MapType(stringTypeN, emptyTypeN))
- structXYZEmptyType = vdl.StructType(vdl.Field{"X", emptyType}, vdl.Field{"Y", emptyType}, vdl.Field{"Z", emptyType})
- structXYZEmptyTypeN = vdl.NamedType("nStructXYZEmpty", vdl.StructType(vdl.Field{"X", emptyTypeN}, vdl.Field{"Y", emptyTypeN}, vdl.Field{"Z", emptyTypeN}))
+ structXYZEmptyType = vdl.StructType(vdl.Field{Name: "X", Type: emptyType}, vdl.Field{Name: "Y", Type: emptyType}, vdl.Field{Name: "Z", Type: emptyType})
+ structXYZEmptyTypeN = vdl.NamedType("nStructXYZEmpty", vdl.StructType(vdl.Field{Name: "X", Type: emptyTypeN}, vdl.Field{Name: "Y", Type: emptyTypeN}, vdl.Field{Name: "Z", Type: emptyTypeN}))
)
func anyValue(x *vdl.Value) *vdl.Value { return vdl.ZeroValue(vdl.AnyType).Assign(x) }
diff --git a/lib/vdl/parse/parse_test.go b/lib/vdl/parse/parse_test.go
index 6e3ba87..7cbe7f1 100644
--- a/lib/vdl/parse/parse_test.go
+++ b/lib/vdl/parse/parse_test.go
@@ -645,14 +645,26 @@
const box = ^3`,
&parse.File{BaseName: "testfile", PackageDef: np("testpkg", 1, 9),
ConstDefs: []*parse.ConstDef{
- {NamePos: np("foo", 2, 7), Expr: &parse.ConstUnaryOp{"!",
- cn("false", 2, 14), pos(2, 13)}},
- {NamePos: np("bar", 3, 7), Expr: &parse.ConstUnaryOp{"+",
- cl(big.NewInt(1), 3, 14), pos(3, 13)}},
- {NamePos: np("baz", 4, 7), Expr: &parse.ConstUnaryOp{"-",
- cl(big.NewInt(2), 4, 14), pos(4, 13)}},
- {NamePos: np("box", 5, 7), Expr: &parse.ConstUnaryOp{"^",
- cl(big.NewInt(3), 5, 14), pos(5, 13)}}}},
+ {NamePos: np("foo", 2, 7), Expr: &parse.ConstUnaryOp{
+ Op: "!",
+ Expr: cn("false", 2, 14),
+ P: pos(2, 13)},
+ },
+ {NamePos: np("bar", 3, 7), Expr: &parse.ConstUnaryOp{
+ Op: "+",
+ Expr: cl(big.NewInt(1), 3, 14),
+ P: pos(3, 13)},
+ },
+ {NamePos: np("baz", 4, 7), Expr: &parse.ConstUnaryOp{
+ Op: "-",
+ Expr: cl(big.NewInt(2), 4, 14),
+ P: pos(4, 13)},
+ },
+ {NamePos: np("box", 5, 7), Expr: &parse.ConstUnaryOp{
+ Op: "^",
+ Expr: cl(big.NewInt(3), 5, 14),
+ P: pos(5, 13),
+ }}}},
nil},
{
"TypeConvConst",
@@ -661,10 +673,16 @@
const bar = pkg.box(false)`,
&parse.File{BaseName: "testfile", PackageDef: np("testpkg", 1, 9),
ConstDefs: []*parse.ConstDef{
- {NamePos: np("foo", 2, 7), Expr: &parse.ConstTypeConv{tn("baz", 2, 13),
- cn("true", 2, 17), pos(2, 13)}},
- {NamePos: np("bar", 3, 7), Expr: &parse.ConstTypeConv{tn("pkg.box", 3, 13),
- cn("false", 3, 21), pos(3, 13)}}}},
+ {NamePos: np("foo", 2, 7), Expr: &parse.ConstTypeConv{
+ Type: tn("baz", 2, 13),
+ Expr: cn("true", 2, 17),
+ P: pos(2, 13),
+ }},
+ {NamePos: np("bar", 3, 7), Expr: &parse.ConstTypeConv{
+ Type: tn("pkg.box", 3, 13),
+ Expr: cn("false", 3, 21),
+ P: pos(3, 13),
+ }}}},
nil},
{
"TypeObjectConst",
@@ -673,10 +691,14 @@
const bar = typeobject(pkg.box)`,
&parse.File{BaseName: "testfile", PackageDef: np("testpkg", 1, 9),
ConstDefs: []*parse.ConstDef{
- {NamePos: np("foo", 2, 7), Expr: &parse.ConstTypeObject{tn("bool", 2, 24),
- pos(2, 13)}},
- {NamePos: np("bar", 3, 7), Expr: &parse.ConstTypeObject{tn("pkg.box", 3, 24),
- pos(3, 13)}}}},
+ {NamePos: np("foo", 2, 7), Expr: &parse.ConstTypeObject{
+ Type: tn("bool", 2, 24),
+ P: pos(2, 13),
+ }},
+ {NamePos: np("bar", 3, 7), Expr: &parse.ConstTypeObject{
+ Type: tn("pkg.box", 3, 24),
+ P: pos(3, 13),
+ }}}},
nil},
{
"BinaryOpConst",
@@ -703,58 +725,130 @@
ConstDefs: []*parse.ConstDef{
{NamePos: np("a", 2, 7),
Expr: &parse.ConstBinaryOp{
- "||", cn("true", 2, 11), cn("false", 2, 19), pos(2, 16)}},
+ Op: "||",
+ Lexpr: cn("true", 2, 11),
+ Rexpr: cn("false", 2, 19),
+ P: pos(2, 16),
+ }},
{NamePos: np("b", 3, 7),
Expr: &parse.ConstBinaryOp{
- "&&", cn("true", 3, 11), cn("false", 3, 19), pos(3, 16)}},
+ Op: "&&",
+ Lexpr: cn("true", 3, 11),
+ Rexpr: cn("false", 3, 19),
+ P: pos(3, 16),
+ }},
{NamePos: np("c", 4, 7),
- Expr: &parse.ConstBinaryOp{"<", cl(big.NewInt(1), 4, 11),
- cl(big.NewInt(2), 4, 15), pos(4, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "<",
+ Lexpr: cl(big.NewInt(1), 4, 11),
+ Rexpr: cl(big.NewInt(2), 4, 15),
+ P: pos(4, 13),
+ }},
{NamePos: np("d", 5, 7),
- Expr: &parse.ConstBinaryOp{">", cl(big.NewInt(3), 5, 11),
- cl(big.NewInt(4), 5, 15), pos(5, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: ">",
+ Lexpr: cl(big.NewInt(3), 5, 11),
+ Rexpr: cl(big.NewInt(4), 5, 15),
+ P: pos(5, 13),
+ }},
{NamePos: np("e", 6, 7),
- Expr: &parse.ConstBinaryOp{"<=", cl(big.NewInt(5), 6, 11),
- cl(big.NewInt(6), 6, 16), pos(6, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "<=",
+ Lexpr: cl(big.NewInt(5), 6, 11),
+ Rexpr: cl(big.NewInt(6), 6, 16),
+ P: pos(6, 13),
+ }},
{NamePos: np("f", 7, 7),
- Expr: &parse.ConstBinaryOp{">=", cl(big.NewInt(7), 7, 11),
- cl(big.NewInt(8), 7, 16), pos(7, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: ">=",
+ Lexpr: cl(big.NewInt(7), 7, 11),
+ Rexpr: cl(big.NewInt(8), 7, 16),
+ P: pos(7, 13),
+ }},
{NamePos: np("g", 8, 7),
- Expr: &parse.ConstBinaryOp{"!=", cl(big.NewInt(9), 8, 11),
- cl(big.NewInt(8), 8, 16), pos(8, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "!=",
+ Lexpr: cl(big.NewInt(9), 8, 11),
+ Rexpr: cl(big.NewInt(8), 8, 16),
+ P: pos(8, 13),
+ }},
{NamePos: np("h", 9, 7),
- Expr: &parse.ConstBinaryOp{"==", cl(big.NewInt(7), 9, 11),
- cl(big.NewInt(6), 9, 16), pos(9, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "==",
+ Lexpr: cl(big.NewInt(7), 9, 11),
+ Rexpr: cl(big.NewInt(6), 9, 16),
+ P: pos(9, 13),
+ }},
{NamePos: np("i", 10, 7),
- Expr: &parse.ConstBinaryOp{"+", cl(big.NewInt(5), 10, 11),
- cl(big.NewInt(4), 10, 15), pos(10, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "+",
+ Lexpr: cl(big.NewInt(5), 10, 11),
+ Rexpr: cl(big.NewInt(4), 10, 15),
+ P: pos(10, 13),
+ }},
{NamePos: np("j", 11, 7),
- Expr: &parse.ConstBinaryOp{"-", cl(big.NewInt(3), 11, 11),
- cl(big.NewInt(2), 11, 15), pos(11, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "-",
+ Lexpr: cl(big.NewInt(3), 11, 11),
+ Rexpr: cl(big.NewInt(2), 11, 15),
+ P: pos(11, 13),
+ }},
{NamePos: np("k", 12, 7),
- Expr: &parse.ConstBinaryOp{"*", cl(big.NewInt(1), 12, 11),
- cl(big.NewInt(2), 12, 15), pos(12, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "*",
+ Lexpr: cl(big.NewInt(1), 12, 11),
+ Rexpr: cl(big.NewInt(2), 12, 15),
+ P: pos(12, 13),
+ }},
{NamePos: np("l", 13, 7),
- Expr: &parse.ConstBinaryOp{"/", cl(big.NewInt(3), 13, 11),
- cl(big.NewInt(4), 13, 15), pos(13, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "/",
+ Lexpr: cl(big.NewInt(3), 13, 11),
+ Rexpr: cl(big.NewInt(4), 13, 15),
+ P: pos(13, 13),
+ }},
{NamePos: np("m", 14, 7),
- Expr: &parse.ConstBinaryOp{"%", cl(big.NewInt(5), 14, 11),
- cl(big.NewInt(6), 14, 15), pos(14, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "%",
+ Lexpr: cl(big.NewInt(5), 14, 11),
+ Rexpr: cl(big.NewInt(6), 14, 15),
+ P: pos(14, 13),
+ }},
{NamePos: np("n", 15, 7),
- Expr: &parse.ConstBinaryOp{"|", cl(big.NewInt(7), 15, 11),
- cl(big.NewInt(8), 15, 15), pos(15, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "|",
+ Lexpr: cl(big.NewInt(7), 15, 11),
+ Rexpr: cl(big.NewInt(8), 15, 15),
+ P: pos(15, 13),
+ }},
{NamePos: np("o", 16, 7),
- Expr: &parse.ConstBinaryOp{"&", cl(big.NewInt(9), 16, 11),
- cl(big.NewInt(8), 16, 15), pos(16, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "&",
+ Lexpr: cl(big.NewInt(9), 16, 11),
+ Rexpr: cl(big.NewInt(8), 16, 15),
+ P: pos(16, 13),
+ }},
{NamePos: np("p", 17, 7),
- Expr: &parse.ConstBinaryOp{"^", cl(big.NewInt(7), 17, 11),
- cl(big.NewInt(6), 17, 15), pos(17, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "^",
+ Lexpr: cl(big.NewInt(7), 17, 11),
+ Rexpr: cl(big.NewInt(6), 17, 15),
+ P: pos(17, 13),
+ }},
{NamePos: np("q", 18, 7),
- Expr: &parse.ConstBinaryOp{"<<", cl(big.NewInt(5), 18, 11),
- cl(big.NewInt(4), 18, 16), pos(18, 13)}},
+ Expr: &parse.ConstBinaryOp{
+ Op: "<<",
+ Lexpr: cl(big.NewInt(5), 18, 11),
+ Rexpr: cl(big.NewInt(4), 18, 16),
+ P: pos(18, 13),
+ }},
{NamePos: np("r", 19, 7),
- Expr: &parse.ConstBinaryOp{">>", cl(big.NewInt(3), 19, 11),
- cl(big.NewInt(2), 19, 16), pos(19, 13)}}}},
+ Expr: &parse.ConstBinaryOp{
+ Op: ">>",
+ Lexpr: cl(big.NewInt(3), 19, 11),
+ Rexpr: cl(big.NewInt(2), 19, 16),
+ P: pos(19, 13),
+ }}}},
nil},
{
"FAILConstOnlyName",
diff --git a/runtime/internal/naming/namespace/all_test.go b/runtime/internal/naming/namespace/all_test.go
index 0844c4f..04febd1 100644
--- a/runtime/internal/naming/namespace/all_test.go
+++ b/runtime/internal/naming/namespace/all_test.go
@@ -137,11 +137,11 @@
switch t.suffix {
case "":
if n := "level1"; m.Match(n) {
- call.SendStream().Send(naming.GlobChildrenReplyName{n})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: n})
}
case "level1":
if n := "level2"; m.Match(n) {
- call.SendStream().Send(naming.GlobChildrenReplyName{n})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: n})
}
default:
return nil
diff --git a/runtime/internal/naming/namespace/cache_test.go b/runtime/internal/naming/namespace/cache_test.go
index b3606f8..457ea85 100644
--- a/runtime/internal/naming/namespace/cache_test.go
+++ b/runtime/internal/naming/namespace/cache_test.go
@@ -22,7 +22,7 @@
}
func future(secs uint32) vdltime.Deadline {
- return vdltime.Deadline{time.Now().Add(time.Duration(secs) * time.Second)}
+ return vdltime.Deadline{Time: time.Now().Add(time.Duration(secs) * time.Second)}
}
// TestCache tests the cache directly rather than via the namespace methods.
@@ -89,7 +89,7 @@
func TestCacheTTL(t *testing.T) {
ctx, cancel := test.TestContext()
defer cancel()
- before := vdltime.Deadline{time.Now()}
+ before := vdltime.Deadline{Time: time.Now()}
c := newTTLCache().(*ttlCache)
// Fill cache.
e := &naming.MountEntry{Servers: []naming.MountedServer{naming.MountedServer{Server: "the rain in spain", Deadline: future(3000)}}}
diff --git a/runtime/internal/naming/namespace/glob.go b/runtime/internal/naming/namespace/glob.go
index e5ca02e..ae24caf 100644
--- a/runtime/internal/naming/namespace/glob.go
+++ b/runtime/internal/naming/namespace/glob.go
@@ -180,7 +180,7 @@
// If no tasks are running, return.
if t.error != nil {
if !notAnMT(t.error) {
- reply <- &naming.GlobReplyError{naming.GlobError{Name: naming.Join(prefix, t.me.Name), Error: t.error}}
+ reply <- &naming.GlobReplyError{Value: naming.GlobError{Name: naming.Join(prefix, t.me.Name), Error: t.error}}
}
inFlight--
continue
@@ -190,7 +190,7 @@
if t.er != nil {
x := *t.er
x.Name = naming.Join(prefix, x.Name)
- reply <- &naming.GlobReplyError{x}
+ reply <- &naming.GlobReplyError{Value: x}
continue
}
@@ -205,7 +205,7 @@
if suffix.Len() == 0 && t.depth != 0 {
x := *t.me
x.Name = naming.Join(prefix, x.Name)
- reply <- &naming.GlobReplyEntry{x}
+ reply <- &naming.GlobReplyEntry{Value: x}
}
// If the pattern is finished (so we're only querying about the root on the
diff --git a/runtime/internal/naming/namespace/namespace.go b/runtime/internal/naming/namespace/namespace.go
index dc8db7c..1a9f109 100644
--- a/runtime/internal/naming/namespace/namespace.go
+++ b/runtime/internal/naming/namespace/namespace.go
@@ -131,7 +131,7 @@
func (ns *namespace) rootMountEntry(name string, opts ...naming.NamespaceOpt) (*naming.MountEntry, bool) {
_, name = security.SplitPatternName(naming.Clean(name))
e := new(naming.MountEntry)
- deadline := vdltime.Deadline{time.Now().Add(time.Hour)} // plenty of time for a call
+ deadline := vdltime.Deadline{Time: time.Now().Add(time.Hour)} // plenty of time for a call
address, suffix := naming.SplitAddressName(name)
if len(address) == 0 {
e.ServesMountTable = true
diff --git a/runtime/internal/rpc/blessings_cache.go b/runtime/internal/rpc/blessings_cache.go
index a6e9d92..7b201bb 100644
--- a/runtime/internal/rpc/blessings_cache.go
+++ b/runtime/internal/rpc/blessings_cache.go
@@ -122,7 +122,7 @@
return rpc.BlessingsRequest{Key: val.id}
}
// otherwise we still need to send both key and blessings, but we must ensure that we send the same key.
- return rpc.BlessingsRequest{val.id, &blessings}
+ return rpc.BlessingsRequest{Key: val.id, Blessings: &blessings}
}
// nextIdLocked creates a new id for inserting blessings. It must be called after acquiring a writer lock.
diff --git a/runtime/internal/rpc/client.go b/runtime/internal/rpc/client.go
index 26b7e91..1aad0f8 100644
--- a/runtime/internal/rpc/client.go
+++ b/runtime/internal/rpc/client.go
@@ -850,7 +850,7 @@
Suffix: suffix,
Method: method,
NumPosArgs: uint64(len(args)),
- Deadline: vtime.Deadline{deadline},
+ Deadline: vtime.Deadline{Time: deadline},
GrantedBlessings: fc.grantedBlessings,
Blessings: blessingsRequest,
Discharges: fc.discharges,
@@ -909,7 +909,10 @@
}
}
if id := verror.ErrorID(err); id != verror.ErrUnknown.ID {
- return verror.IDAction{id, verror.Action(err)}, err
+ return verror.IDAction{
+ ID: id,
+ Action: verror.Action(err),
+ }, err
}
return verror.ErrBadProtocol, err
}
diff --git a/runtime/internal/rpc/full_test.go b/runtime/internal/rpc/full_test.go
index 9c26e2b..2da28c4 100644
--- a/runtime/internal/rpc/full_test.go
+++ b/runtime/internal/rpc/full_test.go
@@ -530,8 +530,12 @@
{bTwoBlessings, "mountpoint/server", O{options.AllowedServersPolicy{"root/other"}}, noErrID, ""},
// Test the ServerPublicKey option.
- {bOther, "mountpoint/server", O{options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{bOther.PublicKey()}}, noErrID, ""},
- {bOther, "mountpoint/server", O{options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{testutil.NewPrincipal("irrelevant").PublicKey()}}, verror.ErrNotTrusted, publicKeyErr},
+ {bOther, "mountpoint/server", O{options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{
+ PublicKey: bOther.PublicKey(),
+ }}, noErrID, ""},
+ {bOther, "mountpoint/server", O{options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{
+ PublicKey: testutil.NewPrincipal("irrelevant").PublicKey(),
+ }}, verror.ErrNotTrusted, publicKeyErr},
// Test the "paranoid" names, where the pattern is provided in the name.
{bServer, "__(root/server)/mountpoint/server", nil, noErrID, ""},
@@ -1736,7 +1740,7 @@
// to act as batman (as opposed to using the default blessing).
ns := tnaming.NewSimpleNamespace()
- defer runServer(t, sctx, ns, "mountpoint/batman", &testServer{}, options.ServerBlessings{batman}).Shutdown()
+ defer runServer(t, sctx, ns, "mountpoint/batman", &testServer{}, options.ServerBlessings{Blessings: batman}).Shutdown()
defer runServer(t, sctx, ns, "mountpoint/default", &testServer{}).Shutdown()
// And finally, make an RPC and see that the client sees "batman"
@@ -2015,11 +2019,15 @@
defer client.Close()
// The call should succeed when the server presents the same public as the opt...
- if _, err = client.StartCall(cctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{pserver.PublicKey()}); err != nil {
+ if _, err = client.StartCall(cctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{
+ PublicKey: pserver.PublicKey(),
+ }); err != nil {
t.Errorf("Expected call to succeed but got %v", err)
}
// ...but fail if they differ.
- if _, err = client.StartCall(cctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{pother.PublicKey()}); verror.ErrorID(err) != verror.ErrNotTrusted.ID {
+ if _, err = client.StartCall(cctx, mountName, "Closure", nil, options.SkipServerEndpointAuthorization{}, options.ServerPublicKey{
+ PublicKey: pother.PublicKey(),
+ }); verror.ErrorID(err) != verror.ErrNotTrusted.ID {
t.Errorf("got %v, want %v", verror.ErrorID(err), verror.ErrNotTrusted.ID)
}
}
diff --git a/runtime/internal/rpc/reserved.go b/runtime/internal/rpc/reserved.go
index c82aaa0..35adc61 100644
--- a/runtime/internal/rpc/reserved.go
+++ b/runtime/internal/rpc/reserved.go
@@ -230,7 +230,7 @@
if state.depth > maxRecursiveGlobDepth {
ctx.Errorf("rpc Glob: exceeded recursion limit (%d): %q", maxRecursiveGlobDepth, suffix)
subcall.Send(naming.GlobReplyError{
- naming.GlobError{Name: state.name, Error: reserved.NewErrGlobMaxRecursionReached(ctx)},
+ Value: naming.GlobError{Name: state.name, Error: reserved.NewErrGlobMaxRecursionReached(ctx)},
})
continue
}
@@ -238,14 +238,14 @@
if err != nil {
ctx.VI(3).Infof("rpc Glob: Lookup failed for %q: %v", suffix, err)
subcall.Send(naming.GlobReplyError{
- naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrNoExist, ctx, err)},
+ Value: naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrNoExist, ctx, err)},
})
continue
}
if obj == nil {
ctx.VI(3).Infof("rpc Glob: object not found for %q", suffix)
subcall.Send(naming.GlobReplyError{
- naming.GlobError{Name: state.name, Error: verror.New(verror.ErrNoExist, ctx, "nil object")},
+ Value: naming.GlobError{Name: state.name, Error: verror.New(verror.ErrNoExist, ctx, "nil object")},
})
continue
}
@@ -263,17 +263,19 @@
if err != nil {
ctx.VI(3).Infof("rpc Glob: object for %q cannot be converted to invoker: %v", suffix, err)
subcall.Send(naming.GlobReplyError{
- naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)},
+ Value: naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)},
})
continue
}
gs := invoker.Globber()
if gs == nil || (gs.AllGlobber == nil && gs.ChildrenGlobber == nil && gs.AllGlobberX == nil && gs.ChildrenGlobberX == nil) {
if state.glob.Len() == 0 {
- subcall.Send(naming.GlobReplyEntry{naming.MountEntry{Name: state.name, IsLeaf: true}})
+ subcall.Send(naming.GlobReplyEntry{
+ Value: naming.MountEntry{Name: state.name, IsLeaf: true},
+ })
} else {
subcall.Send(naming.GlobReplyError{
- naming.GlobError{Name: state.name, Error: reserved.NewErrGlobNotImplemented(ctx)},
+ Value: naming.GlobError{Name: state.name, Error: reserved.NewErrGlobNotImplemented(ctx)},
})
}
continue
@@ -304,7 +306,9 @@
}
if err := gs.AllGlobber.Glob__(ctx, &globServerCall{subcall, send}, state.glob); err != nil {
ctx.VI(3).Infof("rpc Glob: %q.Glob(%q) failed: %v", suffix, state.glob, err)
- subcall.Send(naming.GlobReplyError{naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)}})
+ subcall.Send(naming.GlobReplyError{
+ Value: naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)},
+ })
}
continue
}
@@ -313,7 +317,9 @@
depth := state.depth
if state.glob.Len() == 0 {
// The glob pattern matches the current object.
- subcall.Send(naming.GlobReplyEntry{naming.MountEntry{Name: state.name}})
+ subcall.Send(naming.GlobReplyEntry{
+ Value: naming.MountEntry{Name: state.name},
+ })
if state.glob.Recursive() {
// This is a recursive pattern. Make sure we don't recurse forever.
depth++
@@ -342,18 +348,22 @@
queue = append(queue, gState{next, tail, depth})
case naming.GlobChildrenReplyError:
v.Value.Name = naming.Join(state.name, v.Value.Name)
- return subcall.Send(naming.GlobReplyError{v.Value})
+ return subcall.Send(naming.GlobReplyError{Value: v.Value})
}
return nil
}
if err := gs.ChildrenGlobber.GlobChildren__(ctx, &globChildrenServerCall{subcall, send}, matcher); err != nil {
- subcall.Send(naming.GlobReplyError{naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)}})
+ subcall.Send(naming.GlobReplyError{
+ Value: naming.GlobError{Name: state.name, Error: verror.Convert(verror.ErrInternal, ctx, err)},
+ })
}
continue
}
}
if someMatchesOmitted {
- call.Send(naming.GlobReplyError{naming.GlobError{Error: reserved.NewErrGlobMatchesOmitted(ctx)}})
+ call.Send(naming.GlobReplyError{
+ Value: naming.GlobError{Error: reserved.NewErrGlobMatchesOmitted(ctx)},
+ })
}
return nil
}
diff --git a/runtime/internal/rpc/server.go b/runtime/internal/rpc/server.go
index 1e30282..9f97089 100644
--- a/runtime/internal/rpc/server.go
+++ b/runtime/internal/rpc/server.go
@@ -288,7 +288,11 @@
}
status.Proxies = make([]rpc.ProxyStatus, 0, len(s.proxies))
for k, v := range s.proxies {
- status.Proxies = append(status.Proxies, rpc.ProxyStatus{k, v.endpoint, v.err})
+ status.Proxies = append(status.Proxies, rpc.ProxyStatus{
+ Proxy: k,
+ Endpoint: v.endpoint,
+ Error: v.err,
+ })
}
return status
}
diff --git a/runtime/internal/rpc/server_authorizer_test.go b/runtime/internal/rpc/server_authorizer_test.go
index 68afdec..be56861 100644
--- a/runtime/internal/rpc/server_authorizer_test.go
+++ b/runtime/internal/rpc/server_authorizer_test.go
@@ -94,7 +94,7 @@
// Only otherAli is authorized (since only pother's public key is
// authorized)
[]string{"ali"},
- newServerAuthorizer("", options.ServerPublicKey{pother.PublicKey()}),
+ newServerAuthorizer("", options.ServerPublicKey{PublicKey: pother.PublicKey()}),
[]security.Blessings{otherAli},
[]security.Blessings{ali, bob, che},
},
diff --git a/runtime/internal/rpc/stream/benchmark/dial_vc.go b/runtime/internal/rpc/stream/benchmark/dial_vc.go
index e0cbe02..c376783 100644
--- a/runtime/internal/rpc/stream/benchmark/dial_vc.go
+++ b/runtime/internal/rpc/stream/benchmark/dial_vc.go
@@ -47,7 +47,7 @@
}
// Create one VC to prevent the underlying VIF from being closed.
- _, err = client.Dial(ctx, ep, vc.IdleTimeout{0})
+ _, err = client.Dial(ctx, ep, vc.IdleTimeout{Duration: 0})
if err != nil {
b.Fatal(err)
}
diff --git a/runtime/internal/rpc/stream/crypto/crypto_test.go b/runtime/internal/rpc/stream/crypto/crypto_test.go
index ed27061..b44af89 100644
--- a/runtime/internal/rpc/stream/crypto/crypto_test.go
+++ b/runtime/internal/rpc/stream/crypto/crypto_test.go
@@ -38,7 +38,7 @@
func TestNull(t *testing.T) {
crypter := NewNullCrypter()
quickTest(t, crypter, crypter)
- crypter.String() // Only to test that String does not crash.
+ _ = crypter.String() // Only to test that String does not crash.
}
func TestNullWithChannelBinding(t *testing.T) {
@@ -48,13 +48,13 @@
if got := crypter.ChannelBinding(); !bytes.Equal(cb, got) {
t.Errorf("Unexpected channel binding; got %q, want %q", got, cb)
}
- crypter.String() // Only to test that String does not crash.
+ _ = crypter.String() // Only to test that String does not crash.
}
func testSimple(t *testing.T, c1, c2 Crypter) {
// Execute String just to check that it does not crash.
- c1.String()
- c2.String()
+ _ = c1.String()
+ _ = c2.String()
if t.Failed() {
return
}
diff --git a/runtime/internal/rpc/stream/manager/listener.go b/runtime/internal/rpc/stream/manager/listener.go
index a25c514..64a7819 100644
--- a/runtime/internal/rpc/stream/manager/listener.go
+++ b/runtime/internal/rpc/stream/manager/listener.go
@@ -109,7 +109,7 @@
// Set the default idle timeout for VC. But for "unixfd", we do not set
// the idle timeout since we cannot reconnect it.
if ln.netLn.Addr().Network() != "unixfd" {
- opts = append([]stream.ListenerOpt{vc.IdleTimeout{defaultIdleTimeout}}, opts...)
+ opts = append([]stream.ListenerOpt{vc.IdleTimeout{Duration: defaultIdleTimeout}}, opts...)
}
ln.netLoop.Add(1)
@@ -171,7 +171,7 @@
func (ln *netListener) netAcceptLoop(blessings security.Blessings, opts []stream.ListenerOpt) {
defer ln.netLoop.Done()
- opts = append([]stream.ListenerOpt{vc.StartTimeout{defaultStartTimeout}}, opts...)
+ opts = append([]stream.ListenerOpt{vc.StartTimeout{Duration: defaultStartTimeout}}, opts...)
for {
conn, err := ln.netLn.Accept()
if isTemporaryError(err) {
@@ -319,7 +319,7 @@
return nil, nil, err
}
// Prepend the default idle timeout for VC.
- opts = append([]stream.ListenerOpt{vc.IdleTimeout{defaultIdleTimeout}}, opts...)
+ opts = append([]stream.ListenerOpt{vc.IdleTimeout{Duration: defaultIdleTimeout}}, opts...)
if err := vf.StartAccepting(opts...); err != nil {
return nil, nil, verror.New(stream.ErrNetwork, nil, verror.New(errAlreadyConnected, nil, vf, err))
}
diff --git a/runtime/internal/rpc/stream/manager/manager.go b/runtime/internal/rpc/stream/manager/manager.go
index 1b63a9f..7b3a7ad 100644
--- a/runtime/internal/rpc/stream/manager/manager.go
+++ b/runtime/internal/rpc/stream/manager/manager.go
@@ -169,7 +169,7 @@
return nil, err
}
- opts = append([]stream.VCOpt{vc.StartTimeout{defaultStartTimeout}}, opts...)
+ opts = append([]stream.VCOpt{vc.StartTimeout{Duration: defaultStartTimeout}}, opts...)
vf, err = vif.InternalNewDialedVIF(ctx, conn, m.rid, nil, m.deleteVIF, opts...)
if err != nil {
conn.Close()
@@ -187,7 +187,7 @@
if err != nil {
return nil, err
}
- opts = append([]stream.VCOpt{vc.IdleTimeout{defaultIdleTimeout}}, opts...)
+ opts = append([]stream.VCOpt{vc.IdleTimeout{Duration: defaultIdleTimeout}}, opts...)
vc, err := vf.Dial(ctx, remote, opts...)
if !retry || verror.ErrorID(err) != stream.ErrAborted.ID {
return vc, err
diff --git a/runtime/internal/rpc/stream/manager/manager_test.go b/runtime/internal/rpc/stream/manager/manager_test.go
index 622c7af..0d050fd 100644
--- a/runtime/internal/rpc/stream/manager/manager_test.go
+++ b/runtime/internal/rpc/stream/manager/manager_test.go
@@ -427,7 +427,7 @@
var (
server = InternalNew(ctx, naming.FixedRoutingID(0x55555555))
pserver = testutil.NewPrincipal("server")
- lopts = []stream.ListenerOpt{vc.StartTimeout{startTime}}
+ lopts = []stream.ListenerOpt{vc.StartTimeout{Duration: startTime}}
)
sctx, _ := v23.WithPrincipal(ctx, pserver)
@@ -489,9 +489,9 @@
)
if testServer {
- lopts = []stream.ListenerOpt{vc.IdleTimeout{idleTime}}
+ lopts = []stream.ListenerOpt{vc.IdleTimeout{Duration: idleTime}}
} else {
- opts = []stream.VCOpt{vc.IdleTimeout{idleTime}}
+ opts = []stream.VCOpt{vc.IdleTimeout{Duration: idleTime}}
}
// Pause the idle timers.
diff --git a/runtime/internal/rpc/stream/proxy/proxy_test.go b/runtime/internal/rpc/stream/proxy/proxy_test.go
index a16a51f..23fc033 100644
--- a/runtime/internal/rpc/stream/proxy/proxy_test.go
+++ b/runtime/internal/rpc/stream/proxy/proxy_test.go
@@ -368,9 +368,9 @@
lopts []stream.ListenerOpt
)
if testServer {
- lopts = []stream.ListenerOpt{vc.IdleTimeout{idleTime}}
+ lopts = []stream.ListenerOpt{vc.IdleTimeout{Duration: idleTime}}
} else {
- opts = []stream.VCOpt{vc.IdleTimeout{idleTime}}
+ opts = []stream.VCOpt{vc.IdleTimeout{Duration: idleTime}}
}
cctx, _ := v23.WithPrincipal(ctx, pclient)
sctx, _ := v23.WithPrincipal(ctx, pserver)
diff --git a/runtime/internal/rpc/stream/vif/vif.go b/runtime/internal/rpc/stream/vif/vif.go
index d1b1b92..86facf0 100644
--- a/runtime/internal/rpc/stream/vif/vif.go
+++ b/runtime/internal/rpc/stream/vif/vif.go
@@ -360,7 +360,7 @@
Versions: iversion.Range{Min: preauth.Version, Max: preauth.Version},
Options: []message.SetupOption{
&message.NaclBox{PublicKey: *pubKey},
- &message.UseVIFAuthentication{sigPreauth},
+ &message.UseVIFAuthentication{Signature: sigPreauth},
},
},
})
diff --git a/runtime/internal/rpc/stream/vif/vif_test.go b/runtime/internal/rpc/stream/vif/vif_test.go
index 908a711..a67b396 100644
--- a/runtime/internal/rpc/stream/vif/vif_test.go
+++ b/runtime/internal/rpc/stream/vif/vif_test.go
@@ -440,7 +440,11 @@
vfStartTime, remoteStartTime = remoteStartTime, vfStartTime
}
var err error
- vf, remote, err = New(nil, nil, cctx, sctx, notifyFunc, notifyFunc, []stream.VCOpt{vc.StartTimeout{vfStartTime}}, []stream.ListenerOpt{vc.StartTimeout{remoteStartTime}})
+ vf, remote, err = New(nil, nil, cctx, sctx, notifyFunc, notifyFunc, []stream.VCOpt{vc.StartTimeout{
+ Duration: vfStartTime,
+ }}, []stream.ListenerOpt{vc.StartTimeout{
+ Duration: remoteStartTime,
+ }})
if err != nil {
t.Fatal(err)
}
@@ -510,7 +514,7 @@
newVC := func(vf, remote *vif.VIF) (VC stream.VC, ln stream.Listener, remoteVC stream.Connector, triggerTimers func()) {
triggerTimers = vif.SetFakeTimers()
var err error
- VC, remoteVC, err = createVC(cctx, vf, remote, makeEP(0x10), vc.IdleTimeout{idleTime})
+ VC, remoteVC, err = createVC(cctx, vf, remote, makeEP(0x10), vc.IdleTimeout{Duration: idleTime})
if err != nil {
t.Fatal(err)
}
@@ -539,7 +543,7 @@
// Same as above, but with multiple VCs.
vf, remote = newVIF()
triggerTimers = vif.SetFakeTimers()
- if _, _, err := createNVCs(cctx, vf, remote, 0x10, 5, vc.IdleTimeout{idleTime}); err != nil {
+ if _, _, err := createNVCs(cctx, vf, remote, 0x10, 5, vc.IdleTimeout{Duration: idleTime}); err != nil {
t.Fatal(err)
}
triggerTimers()
@@ -713,15 +717,15 @@
// that overlapping ranges work properly, but non-overlapping ranges generate
// errors.
func TestIncompatibleVersions(t *testing.T) {
- unknown := &iversion.Range{version.UnknownRPCVersion, version.UnknownRPCVersion}
+ unknown := &iversion.Range{Min: version.UnknownRPCVersion, Max: version.UnknownRPCVersion}
tests := []versionTestCase{
- {&iversion.Range{2, 2}, &iversion.Range{2, 2}, &iversion.Range{2, 2}, false, false},
- {&iversion.Range{2, 3}, &iversion.Range{3, 5}, &iversion.Range{3, 5}, false, false},
- {&iversion.Range{2, 3}, &iversion.Range{3, 5}, unknown, false, false},
+ {&iversion.Range{Min: 2, Max: 2}, &iversion.Range{Min: 2, Max: 2}, &iversion.Range{Min: 2, Max: 2}, false, false},
+ {&iversion.Range{Min: 2, Max: 3}, &iversion.Range{Min: 3, Max: 5}, &iversion.Range{Min: 3, Max: 5}, false, false},
+ {&iversion.Range{Min: 2, Max: 3}, &iversion.Range{Min: 3, Max: 5}, unknown, false, false},
// VIF error since there are no versions in common.
- {&iversion.Range{2, 3}, &iversion.Range{4, 5}, &iversion.Range{4, 5}, true, true},
- {&iversion.Range{2, 3}, &iversion.Range{4, 5}, unknown, true, true},
+ {&iversion.Range{Min: 2, Max: 3}, &iversion.Range{Min: 4, Max: 5}, &iversion.Range{Min: 4, Max: 5}, true, true},
+ {&iversion.Range{Min: 2, Max: 3}, &iversion.Range{Min: 4, Max: 5}, unknown, true, true},
}
for _, tc := range tests {
diff --git a/runtime/internal/rpc/test/client_test.go b/runtime/internal/rpc/test/client_test.go
index 69d70e9..dcc54ff 100644
--- a/runtime/internal/rpc/test/client_test.go
+++ b/runtime/internal/rpc/test/client_test.go
@@ -279,8 +279,8 @@
}
logErr("no context", err)
- p1 := options.ServerPublicKey{testutil.NewPrincipal().PublicKey()}
- p2 := options.ServerPublicKey{testutil.NewPrincipal().PublicKey()}
+ p1 := options.ServerPublicKey{PublicKey: testutil.NewPrincipal().PublicKey()}
+ p2 := options.ServerPublicKey{PublicKey: testutil.NewPrincipal().PublicKey()}
_, err = client.StartCall(ctx, "noname", "nomethod", nil, p1, p2)
if verror.ErrorID(err) != verror.ErrBadArg.ID {
t.Fatalf("wrong error: %s", err)
diff --git a/runtime/internal/rpc/test/glob_test.go b/runtime/internal/rpc/test/glob_test.go
index a60f0d4..d881b67 100644
--- a/runtime/internal/rpc/test/glob_test.go
+++ b/runtime/internal/rpc/test/glob_test.go
@@ -297,7 +297,7 @@
func (o *globObject) globLoop(call rpc.GlobServerCall, name string, g *glob.Glob, n *node) {
if g.Len() == 0 {
- call.SendStream().Send(naming.GlobReplyEntry{naming.MountEntry{Name: name}})
+ call.SendStream().Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: name}})
}
if g.Empty() {
return
@@ -318,7 +318,7 @@
sender := call.SendStream()
for child, _ := range o.n.children {
if m.Match(child) {
- sender.Send(naming.GlobChildrenReplyName{child})
+ sender.Send(naming.GlobChildrenReplyName{Value: child})
}
}
return nil
diff --git a/runtime/internal/rpc/test/proxy_test.go b/runtime/internal/rpc/test/proxy_test.go
index e7d365a..46c5078 100644
--- a/runtime/internal/rpc/test/proxy_test.go
+++ b/runtime/internal/rpc/test/proxy_test.go
@@ -335,7 +335,7 @@
// Additionally, any server authorizaton options must only apply to the end server
// and not the proxy.
const expected = `method:"Echo",suffix:"suffix",arg:"batman"`
- if result, err := makeCall(options.ServerPublicKey{serverKey}); result != expected || err != nil {
+ if result, err := makeCall(options.ServerPublicKey{PublicKey: serverKey}); result != expected || err != nil {
t.Fatalf("Got (%v, %v) want (%v, nil)", result, err, expected)
}
diff --git a/runtime/internal/rt/ipc_test.go b/runtime/internal/rt/ipc_test.go
index 29c8153..23d320b 100644
--- a/runtime/internal/rt/ipc_test.go
+++ b/runtime/internal/rt/ipc_test.go
@@ -172,7 +172,7 @@
p = v23.GetPrincipal(ctx)
b1 = mkBlessings(p.BlessSelf("dev.v.io/users/foo@bar.com/devices/phone/applications/app"))
b2 = mkBlessings(p.BlessSelf("otherblessing"))
- bopt = options.ServerBlessings{union(b1, b2)}
+ bopt = options.ServerBlessings{Blessings: union(b1, b2)}
tests = []struct {
opts []rpc.ServerOpt
diff --git a/runtime/internal/rt/mgmt.go b/runtime/internal/rt/mgmt.go
index 8893016..28c25cf 100644
--- a/runtime/internal/rt/mgmt.go
+++ b/runtime/internal/rt/mgmt.go
@@ -55,7 +55,7 @@
// Grab the blessing from our blessing store that the parent
// told us to use so they can talk to us.
serverBlessing := rt.GetPrincipal(ctx).BlessingStore().ForPeer(parentPeerPattern)
- serverOpts = append(serverOpts, options.ServerBlessings{serverBlessing})
+ serverOpts = append(serverOpts, options.ServerBlessings{Blessings: serverBlessing})
}
server, err := rt.NewServer(ctx, serverOpts...)
if err != nil {
diff --git a/runtime/internal/rt/mgmt_test.go b/runtime/internal/rt/mgmt_test.go
index 2c59c05..ad1f650 100644
--- a/runtime/internal/rt/mgmt_test.go
+++ b/runtime/internal/rt/mgmt_test.go
@@ -161,7 +161,7 @@
}
func checkProgress(t *testing.T, ch <-chan v23.Task, progress, goal int32) {
- if want, got := (v23.Task{progress, goal}), <-ch; !reflect.DeepEqual(want, got) {
+ if want, got := (v23.Task{Progress: progress, Goal: goal}), <-ch; !reflect.DeepEqual(want, got) {
t.Errorf("Unexpected progress: want %+v, got %+v", want, got)
}
}
diff --git a/runtime/internal/rt/security.go b/runtime/internal/rt/security.go
index 5e439b1..1b8d6cf 100644
--- a/runtime/internal/rt/security.go
+++ b/runtime/internal/rt/security.go
@@ -20,6 +20,7 @@
"v.io/x/ref/lib/mgmt"
vsecurity "v.io/x/ref/lib/security"
inaming "v.io/x/ref/runtime/internal/naming"
+ "v.io/x/ref/services/agent"
"v.io/x/ref/services/agent/agentlib"
)
@@ -48,6 +49,11 @@
return principal, nil, func() {}, nil
}
// Use credentials stored in the agent.
+ if principal, err := ipcAgent(); err != nil {
+ return nil, nil, nil, err
+ } else if principal != nil {
+ return principal, nil, func() { principal.Close() }, nil
+ }
if ep, _, err := agentEP(); err != nil {
return nil, nil, nil, err
} else if ep != nil {
@@ -98,6 +104,24 @@
return ifd, nil
}
+func ipcAgent() (agent.Principal, error) {
+ handle, err := exec.GetChildHandle()
+ if err != nil && verror.ErrorID(err) != exec.ErrNoVersion.ID {
+ return nil, err
+ }
+ var path string
+ if handle != nil {
+ // We were started by a parent (presumably, device manager).
+ path, _ = handle.Config.Get(mgmt.SecurityAgentPathConfigKey)
+ } else {
+ path = os.Getenv(ref.EnvAgentPath)
+ }
+ if path == "" {
+ return nil, nil
+ }
+ return agentlib.NewAgentPrincipalX(path)
+}
+
// agentEP returns an Endpoint to be used to communicate with
// the security agent if the current process has been configured to use the
// agent.
diff --git a/services/agent/agentlib/client.go b/services/agent/agentlib/client.go
index 3f6f82c..1d72439 100644
--- a/services/agent/agentlib/client.go
+++ b/services/agent/agentlib/client.go
@@ -8,9 +8,11 @@
import (
"fmt"
+ "io"
"net"
"os"
"strconv"
+ "sync"
"syscall"
"v.io/v23/context"
@@ -21,7 +23,9 @@
"v.io/v23/verror"
"v.io/v23/vtrace"
"v.io/x/ref/internal/logger"
+ "v.io/x/ref/services/agent"
"v.io/x/ref/services/agent/internal/cache"
+ "v.io/x/ref/services/agent/internal/ipc"
"v.io/x/ref/services/agent/internal/unixfd"
)
@@ -38,13 +42,50 @@
key security.PublicKey
}
-type caller struct {
+type caller interface {
+ call(name string, results []interface{}, args ...interface{}) error
+ io.Closer
+}
+
+type ipcCaller struct {
+ conn *ipc.IPCConn
+ flush func()
+ mu sync.Mutex
+}
+
+func (i *ipcCaller) call(name string, results []interface{}, args ...interface{}) error {
+ return i.conn.Call(name, args, results...)
+}
+
+func (i *ipcCaller) Close() error {
+ i.conn.Close()
+ return nil
+}
+
+func (i *ipcCaller) FlushAllCaches() error {
+ var flush func()
+ i.mu.Lock()
+ flush = i.flush
+ i.mu.Unlock()
+ if flush != nil {
+ flush()
+ }
+ return nil
+}
+
+type vrpcCaller struct {
ctx *context.T
client rpc.Client
name string
+ cancel func()
}
-func (c *caller) call(name string, results []interface{}, args ...interface{}) error {
+func (c *vrpcCaller) Close() error {
+ c.cancel()
+ return nil
+}
+
+func (c *vrpcCaller) call(name string, results []interface{}, args ...interface{}) error {
call, err := c.startCall(name, args...)
if err != nil {
return err
@@ -55,7 +96,7 @@
return nil
}
-func (c *caller) startCall(name string, args ...interface{}) (rpc.ClientCall, error) {
+func (c *vrpcCaller) startCall(name string, args ...interface{}) (rpc.ClientCall, error) {
ctx, _ := vtrace.WithNewTrace(c.ctx)
// SecurityNone is safe here since we're using anonymous unix sockets.
return c.client.StartCall(ctx, c.name, name, args, options.SecurityNone, options.NoResolve{})
@@ -65,6 +106,41 @@
return inputs
}
+func newUncachedPrincipalX(path string) (*client, error) {
+ caller := new(ipcCaller)
+ i := ipc.NewIPC()
+ i.Serve(caller)
+ conn, err := i.Connect(path)
+ if err != nil {
+ return nil, err
+ }
+ caller.conn = conn
+ agent := &client{caller: caller}
+ if err := agent.fetchPublicKey(); err != nil {
+ return nil, err
+ }
+ return agent, nil
+}
+
+// NewAgentPrincipal returns a security.Pricipal using the PrivateKey held in a remote agent process.
+// 'path' is the path to the agent socket, typically obtained from
+// os.GetEnv(envvar.AgentAddress).
+func NewAgentPrincipalX(path string) (agent.Principal, error) {
+ p, err := newUncachedPrincipalX(path)
+ if err != nil {
+ return nil, err
+ }
+ cached, flush, err := cache.NewCachedPrincipalX(p)
+ if err != nil {
+ return nil, err
+ }
+ caller := p.caller.(*ipcCaller)
+ caller.mu.Lock()
+ caller.flush = flush
+ caller.mu.Unlock()
+ return cached, nil
+}
+
// NewAgentPrincipal returns a security.Pricipal using the PrivateKey held in a remote agent process.
// 'endpoint' is the endpoint for connecting to the agent, typically obtained from
// os.GetEnv(envvar.AgentEndpoint).
@@ -75,11 +151,12 @@
if err != nil {
return p, err
}
- call, callErr := p.caller.startCall("NotifyWhenChanged")
+ caller := p.caller.(*vrpcCaller)
+ call, callErr := caller.startCall("NotifyWhenChanged")
if callErr != nil {
return nil, callErr
}
- return cache.NewCachedPrincipal(p.caller.ctx, p, call)
+ return cache.NewCachedPrincipal(caller.ctx, p, call)
}
func newUncachedPrincipal(ctx *context.T, ep naming.Endpoint, insecureClient rpc.Client) (*client, error) {
// This isn't a real vanadium endpoint. It contains the vanadium version
@@ -112,10 +189,12 @@
if err != nil {
return nil, err
}
- caller := caller{
+ ctx, cancel := context.WithCancel(ctx)
+ caller := &vrpcCaller{
client: insecureClient,
name: naming.JoinAddressName(agentEndpoint("unixfd", addr.String()), ""),
ctx: ctx,
+ cancel: cancel,
}
agent := &client{caller: caller}
if err := agent.fetchPublicKey(); err != nil {
@@ -124,6 +203,10 @@
return agent, nil
}
+func (c *client) Close() error {
+ return c.caller.Close()
+}
+
func (c *client) fetchPublicKey() (err error) {
var b []byte
if err = c.caller.call("PublicKey", results(&b)); err != nil {
diff --git a/services/agent/agentlib/peer_test.go b/services/agent/agentlib/peer_test.go
index 99a86a1..3d5ceeb 100644
--- a/services/agent/agentlib/peer_test.go
+++ b/services/agent/agentlib/peer_test.go
@@ -14,3 +14,7 @@
func NewUncachedPrincipal(ctx *context.T, endpoint naming.Endpoint, insecureClient rpc.Client) (security.Principal, error) {
return newUncachedPrincipal(ctx, endpoint, insecureClient)
}
+
+func NewUncachedPrincipalX(path string) (security.Principal, error) {
+ return newUncachedPrincipalX(path)
+}
diff --git a/services/agent/internal/cache/cache.go b/services/agent/internal/cache/cache.go
index 29a518c..f4500a8 100644
--- a/services/agent/internal/cache/cache.go
+++ b/services/agent/internal/cache/cache.go
@@ -12,6 +12,8 @@
"v.io/v23/rpc"
"v.io/v23/security"
"v.io/v23/verror"
+ "v.io/x/ref/internal/logger"
+ "v.io/x/ref/services/agent"
"v.io/x/ref/services/agent/internal/lru"
)
@@ -30,7 +32,6 @@
type cachedRoots struct {
mu *sync.RWMutex
impl security.BlessingRoots
- ctx *context.T
cache map[string][]security.BlessingPattern // GUARDED_BY(mu)
// TODO(ataly): Get rid of the following fields once all agents have been
@@ -39,8 +40,8 @@
negative *lru.Cache // key + blessing -> error
}
-func newCachedRoots(ctx *context.T, impl security.BlessingRoots, mu *sync.RWMutex) (*cachedRoots, error) {
- roots := &cachedRoots{mu: mu, impl: impl, ctx: ctx}
+func newCachedRoots(impl security.BlessingRoots, mu *sync.RWMutex) (*cachedRoots, error) {
+ roots := &cachedRoots{mu: mu, impl: impl}
roots.flush()
if err := roots.fetchAndCacheRoots(); err != nil {
return nil, err
@@ -126,7 +127,7 @@
if !cacheExists {
r.mu.Lock()
if err := r.fetchAndCacheRoots(); err != nil {
- r.ctx.Errorf("failed to cache roots: %v", err)
+ logger.Global().Errorf("failed to cache roots: %v", err)
r.mu.Unlock()
return nil
}
@@ -177,7 +178,7 @@
for keyStr, patterns := range r.cache {
key, err := security.UnmarshalPublicKey([]byte(keyStr))
if err != nil {
- r.ctx.Errorf("security.UnmarshalPublicKey(%v) returned error: %v", []byte(keyStr), err)
+ logger.Global().Errorf("security.UnmarshalPublicKey(%v) returned error: %v", []byte(keyStr), err)
return nil
}
for _, p := range patterns {
@@ -219,7 +220,6 @@
mu *sync.RWMutex
key security.PublicKey
def security.Blessings
- ctx *context.T
hasDef bool
peers map[security.BlessingPattern]security.Blessings
impl security.BlessingStore
@@ -266,7 +266,7 @@
if union, err := security.UnionOfBlessings(ret, b); err == nil {
ret = union
} else {
- s.ctx.Errorf("UnionOfBlessings(%v, %v) failed: %v, dropping the latter from BlessingStore.ForPeers(%v)", ret, b, err, peerBlessings)
+ logger.Global().Errorf("UnionOfBlessings(%v, %v) failed: %v, dropping the latter from BlessingStore.ForPeers(%v)", ret, b, err, peerBlessings)
}
}
}
@@ -341,7 +341,7 @@
// wraps over another implementation and adds caching.
type cachedPrincipal struct {
cache security.Principal
- /* impl */ security.Principal
+ /* impl */ agent.Principal
}
func (p *cachedPrincipal) BlessingsByName(pattern security.BlessingPattern) []security.Blessings {
@@ -364,6 +364,10 @@
return p.cache.AddToRoots(blessings)
}
+func (p *cachedPrincipal) Close() error {
+ return p.Principal.Close()
+}
+
type dummySigner struct {
key security.PublicKey
}
@@ -377,9 +381,32 @@
return s.key
}
-func NewCachedPrincipal(ctx *context.T, impl security.Principal, call rpc.ClientCall) (p security.Principal, err error) {
+func NewCachedPrincipal(ctx *context.T, impl agent.Principal, call rpc.ClientCall) (p agent.Principal, err error) {
+ p, flush, err := NewCachedPrincipalX(impl)
+
+ if err == nil {
+ go func() {
+ var x bool
+ for {
+ if recvErr := call.Recv(&x); recvErr != nil {
+ if ctx.Err() != context.Canceled {
+ logger.Global().Errorf("Error from agent: %v", recvErr)
+ }
+ flush()
+ call.Finish()
+ return
+ }
+ flush()
+ }
+ }()
+ }
+
+ return
+}
+
+func NewCachedPrincipalX(impl agent.Principal) (p agent.Principal, flush func(), err error) {
var mu sync.RWMutex
- cachedRoots, err := newCachedRoots(ctx, impl.Roots(), &mu)
+ cachedRoots, err := newCachedRoots(impl.Roots(), &mu)
if err != nil {
return
}
@@ -387,34 +414,19 @@
mu: &mu,
key: impl.PublicKey(),
impl: impl.BlessingStore(),
- ctx: ctx,
}
- flush := func() {
+ flush = func() {
defer mu.Unlock()
mu.Lock()
cachedRoots.flush()
cachedStore.flush()
}
- p, err = security.CreatePrincipal(dummySigner{impl.PublicKey()}, cachedStore, cachedRoots)
+ sp, err := security.CreatePrincipal(dummySigner{impl.PublicKey()}, cachedStore, cachedRoots)
if err != nil {
return
}
- go func() {
- var x bool
- for {
- if recvErr := call.Recv(&x); recvErr != nil {
- if ctx.Err() != context.Canceled {
- ctx.Errorf("Error from agent: %v", recvErr)
- }
- flush()
- call.Finish()
- return
- }
- flush()
- }
- }()
- p = &cachedPrincipal{p, impl}
+ p = &cachedPrincipal{sp, impl}
return
}
diff --git a/services/agent/internal/cache/cache_test.go b/services/agent/internal/cache/cache_test.go
index b6b53d3..e0c2193 100644
--- a/services/agent/internal/cache/cache_test.go
+++ b/services/agent/internal/cache/cache_test.go
@@ -22,7 +22,7 @@
ctx = context.WithLogger(ctx, logger.Global())
p := testutil.NewPrincipal()
impl := p.Roots()
- roots, err := newCachedRoots(ctx, impl, &mu)
+ roots, err := newCachedRoots(impl, &mu)
if err != nil {
panic(err)
}
diff --git a/services/agent/internal/ipc/ipc.go b/services/agent/internal/ipc/ipc.go
index 000d716..ca1bd9d 100644
--- a/services/agent/internal/ipc/ipc.go
+++ b/services/agent/internal/ipc/ipc.go
@@ -291,7 +291,7 @@
func (ipc *IPC) startCall(c *IPCConn, method string, args []interface{}, results []interface{}) (ch chan error) {
ch = make(chan error, 1)
- header := agent.RpcMessageReq{agent.RpcRequest{Method: method, NumArgs: uint32(len(args))}}
+ header := agent.RpcMessageReq{Value: agent.RpcRequest{Method: method, NumArgs: uint32(len(args))}}
shouldClose := false
defer func() {
// Only close c after we unlock it.
diff --git a/services/agent/internal/ipc/ipc_test.go b/services/agent/internal/ipc/ipc_test.go
index 4c553eb..39d3ba0 100644
--- a/services/agent/internal/ipc/ipc_test.go
+++ b/services/agent/internal/ipc/ipc_test.go
@@ -123,7 +123,7 @@
t.Fatal(err)
}
- if err = enc.Encode(agent.RpcMessageReq{agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
+ if err = enc.Encode(agent.RpcMessageReq{Value: agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
t.Fatal(err)
}
var response agent.RpcMessage
@@ -153,7 +153,7 @@
t.Fatal(err)
}
- if err = enc.Encode(agent.RpcMessageReq{agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
+ if err = enc.Encode(agent.RpcMessageReq{Value: agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
if err != io.EOF {
t.Fatal(err)
}
@@ -185,7 +185,7 @@
t.Fatal(err)
}
- if err = enc.Encode(agent.RpcMessageReq{agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
+ if err = enc.Encode(agent.RpcMessageReq{Value: agent.RpcRequest{Id: 0, Method: "foo", NumArgs: 0}}); err != nil {
if err != io.EOF {
t.Fatal(err)
}
diff --git a/services/agent/keymgr/client.go b/services/agent/keymgr/client.go
index 01098de..ae837dd 100644
--- a/services/agent/keymgr/client.go
+++ b/services/agent/keymgr/client.go
@@ -14,6 +14,8 @@
"v.io/v23/context"
"v.io/v23/verror"
+ "v.io/x/ref/services/agent"
+ "v.io/x/ref/services/agent/internal/ipc"
"v.io/x/ref/services/agent/internal/server"
"v.io/x/ref/services/agent/internal/unixfd"
)
@@ -30,6 +32,10 @@
const defaultManagerSocket = 4
+type KeyManager struct {
+ conn *ipc.IPCConn
+}
+
type Agent struct {
conn *net.UnixConn // Guarded by mu
mu sync.Mutex
@@ -40,6 +46,17 @@
return newAgent(defaultManagerSocket)
}
+// NewKeyManager returns a client connected to the specified KeyManager.
+func NewKeyManager(path string) (agent.KeyManager, error) {
+ i := ipc.NewIPC()
+ conn, err := i.Connect(path)
+ var m *KeyManager
+ if err == nil {
+ m = &KeyManager{conn}
+ }
+ return m, err
+}
+
func NewLocalAgent(ctx *context.T, path string, passphrase []byte) (*Agent, error) {
file, err := server.RunKeyManager(ctx, path, passphrase)
if err != nil {
@@ -79,19 +96,27 @@
if err != nil {
return nil, nil, err
}
- buf := make([]byte, server.PrincipalHandleByteSize)
+ buf := make([]byte, agent.PrincipalHandleByteSize)
n, err := a.conn.Read(buf)
if err != nil {
conn.Close()
return nil, nil, err
}
- if n != server.PrincipalHandleByteSize {
+ if n != agent.PrincipalHandleByteSize {
conn.Close()
- return nil, nil, verror.New(errInvalidResponse, ctx, server.PrincipalHandleByteSize, n)
+ return nil, nil, verror.New(errInvalidResponse, ctx, agent.PrincipalHandleByteSize, n)
}
return buf, conn, nil
}
+// NewPrincipal creates a new principal and returns a handle.
+// The handle may be passed to ServePrincipal to start an agent serving the principal.
+func (m *KeyManager) NewPrincipal(inMemory bool) (handle [agent.PrincipalHandleByteSize]byte, err error) {
+ args := []interface{}{inMemory}
+ err = m.conn.Call("NewPrincipal", args, &handle)
+ return
+}
+
func (a *Agent) connect(req []byte) (*os.File, error) {
addr, err := unixfd.SendConnection(a.conn, req)
if err != nil {
@@ -108,10 +133,37 @@
// previously created with NewPrincipal.
// Typically this will be passed to a child process using cmd.ExtraFiles.
func (a *Agent) NewConnection(handle []byte) (*os.File, error) {
- if len(handle) != server.PrincipalHandleByteSize {
+ if len(handle) != agent.PrincipalHandleByteSize {
return nil, verror.New(errInvalidKeyHandle, nil)
}
a.mu.Lock()
defer a.mu.Unlock()
return a.connect(handle)
}
+
+// ServePrincipal creates a socket at socketPath and serves a principal
+// previously created with NewPrincipal.
+func (m *KeyManager) ServePrincipal(handle [agent.PrincipalHandleByteSize]byte, socketPath string) error {
+ args := []interface{}{handle, socketPath}
+ return m.conn.Call("ServePrincipal", args)
+}
+
+// StopServing shuts down a server previously started with ServePrincipal.
+// The principal is not deleted and the server can be restarted by calling
+// ServePrincipal again.
+func (m *KeyManager) StopServing(handle [agent.PrincipalHandleByteSize]byte) error {
+ args := []interface{}{handle}
+ return m.conn.Call("StopServing", args)
+}
+
+// DeletePrincipal shuts down a server started by ServePrincipal and additionally
+// deletes the principal.
+func (m *KeyManager) DeletePrincipal(handle [agent.PrincipalHandleByteSize]byte) error {
+ args := []interface{}{handle}
+ return m.conn.Call("DeletePrincipal", args)
+}
+
+func (m *KeyManager) Close() error {
+ m.conn.Close()
+ return nil
+}
diff --git a/services/agent/model.go b/services/agent/model.go
new file mode 100644
index 0000000..38d6ece
--- /dev/null
+++ b/services/agent/model.go
@@ -0,0 +1,27 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package agent
+
+import (
+ "crypto/sha512"
+ "io"
+
+ "v.io/v23/security"
+)
+
+type Principal interface {
+ security.Principal
+ io.Closer
+}
+
+const PrincipalHandleByteSize = sha512.Size
+
+type KeyManager interface {
+ NewPrincipal(inMemory bool) (handle [PrincipalHandleByteSize]byte, err error)
+ ServePrincipal(handle [PrincipalHandleByteSize]byte, socketPath string) error
+ StopServing(handle [PrincipalHandleByteSize]byte) error
+ DeletePrincipal(handle [PrincipalHandleByteSize]byte) error
+ io.Closer
+}
diff --git a/services/application/applicationd/service.go b/services/application/applicationd/service.go
index c4e833e..2ea8bff 100644
--- a/services/application/applicationd/service.go
+++ b/services/application/applicationd/service.go
@@ -249,7 +249,7 @@
for _, r := range results {
if m.Match(r) {
- call.SendStream().Send(naming.GlobChildrenReplyName{r})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: r})
}
}
return nil
diff --git a/services/binary/tidy/binaryd/mock.go b/services/binary/tidy/binaryd/mock.go
index a9c1db0..d3efd8c 100644
--- a/services/binary/tidy/binaryd/mock.go
+++ b/services/binary/tidy/binaryd/mock.go
@@ -74,7 +74,7 @@
gs := GlobStimulus{g.String()}
gr := mdi.Tape.Record(gs).(GlobResponse)
for _, r := range gr.Results {
- call.SendStream().Send(naming.GlobReplyEntry{naming.MountEntry{Name: r}})
+ call.SendStream().Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: r}})
}
return gr.Err
}
diff --git a/services/device/device/claim.go b/services/device/device/claim.go
index 8d65e4d..2fb911c 100644
--- a/services/device/device/claim.go
+++ b/services/device/device/claim.go
@@ -54,7 +54,7 @@
if deviceKey, err := security.UnmarshalPublicKey(marshalledPublicKey); err != nil {
return fmt.Errorf("Failed to unmarshal device public key:%v", err)
} else {
- serverKeyOpts = options.ServerPublicKey{deviceKey}
+ serverKeyOpts = options.ServerPublicKey{PublicKey: deviceKey}
}
}
// Skip server endpoint authorization since an unclaimed device might have
diff --git a/services/device/device/devicemanager_mock_test.go b/services/device/device/devicemanager_mock_test.go
index 6d1e486..4ca86c9 100644
--- a/services/device/device/devicemanager_mock_test.go
+++ b/services/device/device/devicemanager_mock_test.go
@@ -296,7 +296,7 @@
gs := GlobStimulus{g.String()}
gr := mdi.tape.Record(gs).(GlobResponse)
for _, r := range gr.results {
- call.SendStream().Send(naming.GlobReplyEntry{naming.MountEntry{Name: r}})
+ call.SendStream().Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: r}})
}
return gr.err
}
diff --git a/services/device/device/instantiate.go b/services/device/device/instantiate.go
index 8d8ab2c..f6c7b76 100644
--- a/services/device/device/instantiate.go
+++ b/services/device/device/instantiate.go
@@ -67,7 +67,7 @@
if err != nil {
return fmt.Errorf("Instantiate failed: %v", err)
}
- call.SendStream().Send(device.BlessClientMessageAppBlessings{blessings})
+ call.SendStream().Send(device.BlessClientMessageAppBlessings{Value: blessings})
default:
fmt.Fprintf(env.Stderr, "Received unexpected message: %#v\n", msg)
}
diff --git a/services/device/deviced/internal/impl/app_service.go b/services/device/deviced/internal/impl/app_service.go
index 576ffa3..77896fe 100644
--- a/services/device/deviced/internal/impl/app_service.go
+++ b/services/device/deviced/internal/impl/app_service.go
@@ -1455,7 +1455,7 @@
}
for child, _ := range n.children {
if m.Match(child) {
- call.SendStream().Send(naming.GlobChildrenReplyName{child})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: child})
}
}
return nil
diff --git a/services/device/deviced/internal/impl/device_service.go b/services/device/deviced/internal/impl/device_service.go
index 480b8aa..055af58 100644
--- a/services/device/deviced/internal/impl/device_service.go
+++ b/services/device/deviced/internal/impl/device_service.go
@@ -326,7 +326,7 @@
cfg.Set(mgmt.SecurityAgentEndpointConfigKey, ep)
}
- handle := vexec.NewParentHandle(cmd, vexec.ConfigOpt{cfg})
+ handle := vexec.NewParentHandle(cmd, vexec.ConfigOpt{Config: cfg})
// Start the child process.
if err := handle.Start(); err != nil {
ctx.Errorf("Start() failed: %v", err)
diff --git a/services/device/deviced/internal/impl/proxy_invoker.go b/services/device/deviced/internal/impl/proxy_invoker.go
index c395de6..d15dec1 100644
--- a/services/device/deviced/internal/impl/proxy_invoker.go
+++ b/services/device/deviced/internal/impl/proxy_invoker.go
@@ -214,7 +214,7 @@
}
func (p *proxyInvoker) Globber() *rpc.GlobState {
- return &rpc.GlobState{AllGlobberX: p}
+ return &rpc.GlobState{AllGlobber: p}
}
type call struct {
diff --git a/services/device/deviced/internal/impl/utiltest/helpers.go b/services/device/deviced/internal/impl/utiltest/helpers.go
index cd61e3c..3c1a163 100644
--- a/services/device/deviced/internal/impl/utiltest/helpers.go
+++ b/services/device/deviced/internal/impl/utiltest/helpers.go
@@ -327,7 +327,7 @@
if err != nil {
return "", errors.New("bless failed")
}
- call.SendStream().Send(device.BlessClientMessageAppBlessings{blessings})
+ call.SendStream().Send(device.BlessClientMessageAppBlessings{Value: blessings})
default:
return "", fmt.Errorf("newInstanceImpl: received unexpected message: %#v", msg)
}
diff --git a/services/device/deviced/internal/impl/utiltest/modules.go b/services/device/deviced/internal/impl/utiltest/modules.go
index 2a5a029..3f42f83 100644
--- a/services/device/deviced/internal/impl/utiltest/modules.go
+++ b/services/device/deviced/internal/impl/utiltest/modules.go
@@ -92,13 +92,14 @@
// method that calls Stop on the app cycle manager (e.g. the Stop RPC)
// will precipitate an immediate process exit.
shutdownChan := signals.ShutdownOnSignals(ctx)
+ localhost := []struct{ Protocol, Address string }{{"tcp", "127.0.0.1:0"}}
claimableName, stop, err := starter.Start(ctx, starter.Args{
Namespace: starter.NamespaceArgs{
- ListenSpec: rpc.ListenSpec{Addrs: rpc.ListenAddrs{{"tcp", "127.0.0.1:0"}}},
+ ListenSpec: rpc.ListenSpec{Addrs: rpc.ListenAddrs(localhost)},
},
Device: starter.DeviceArgs{
Name: publishName,
- ListenSpec: rpc.ListenSpec{Addrs: rpc.ListenAddrs{{"tcp", "127.0.0.1:0"}}},
+ ListenSpec: rpc.ListenSpec{Addrs: rpc.ListenAddrs(localhost)},
ConfigState: configState,
TestMode: strings.HasSuffix(fmt.Sprint(v23.GetPrincipal(ctx).BlessingStore().Default()), "/testdm"),
RestartCallback: func() { fmt.Println("restart handler") },
diff --git a/services/internal/binarylib/service.go b/services/internal/binarylib/service.go
index 99b25ad..3a43e42 100644
--- a/services/internal/binarylib/service.go
+++ b/services/internal/binarylib/service.go
@@ -391,7 +391,7 @@
}
for k, _ := range n.children {
if m.Match(k) {
- call.SendStream().Send(naming.GlobChildrenReplyName{k})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: k})
}
}
return nil
diff --git a/services/internal/logreaderlib/logfile.go b/services/internal/logreaderlib/logfile.go
index 5a4109d..5654301 100644
--- a/services/internal/logreaderlib/logfile.go
+++ b/services/internal/logreaderlib/logfile.go
@@ -149,7 +149,7 @@
for _, file := range fi {
name := file.Name()
if m.Match(name) {
- call.SendStream().Send(naming.GlobChildrenReplyName{name})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: name})
}
}
}
diff --git a/services/internal/statslib/stats.go b/services/internal/statslib/stats.go
index ddc2735..08f7157 100644
--- a/services/internal/statslib/stats.go
+++ b/services/internal/statslib/stats.go
@@ -44,7 +44,7 @@
sender := call.SendStream()
it := libstats.Glob(i.suffix, g.String(), time.Time{}, false)
for it.Advance() {
- sender.Send(naming.GlobReplyEntry{naming.MountEntry{Name: it.Value().Key}})
+ sender.Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: it.Value().Key}})
}
if err := it.Err(); err != nil {
ctx.VI(1).Infof("libstats.Glob(%q, %q) failed: %v", i.suffix, g.String(), err)
diff --git a/services/mounttable/mounttablelib/mounttable.go b/services/mounttable/mounttablelib/mounttable.go
index d1c7258..52e3e96 100644
--- a/services/mounttable/mounttablelib/mounttable.go
+++ b/services/mounttable/mounttablelib/mounttable.go
@@ -682,7 +682,7 @@
}
// Hold no locks while we are sending on the channel to avoid livelock.
n.Unlock()
- gCall.SendStream().Send(naming.GlobReplyEntry{me})
+ gCall.SendStream().Send(naming.GlobReplyEntry{Value: me})
return
}
@@ -752,7 +752,7 @@
// Hold no locks while we are sending on the channel to avoid livelock.
n.Unlock()
// Intermediate nodes are marked as serving a mounttable since they answer the mounttable methods.
- gCall.SendStream().Send(naming.GlobReplyEntry{naming.MountEntry{Name: name, ServesMountTable: true}})
+ gCall.SendStream().Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: name, ServesMountTable: true}})
}
// Glob finds matches in the namespace. If we reach a mount point before matching the
@@ -798,7 +798,7 @@
servers[i].Server = naming.Join(s.Server, strings.Join(elems, "/"))
}
n.Unlock()
- gCall.SendStream().Send(naming.GlobReplyEntry{naming.MountEntry{Name: "", Servers: servers}})
+ gCall.SendStream().Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: "", Servers: servers}})
}
func (ms *mountContext) SetPermissions(ctx *context.T, call rpc.ServerCall, perms access.Permissions, version string) error {
diff --git a/services/mounttable/mounttablelib/mounttable_test.go b/services/mounttable/mounttablelib/mounttable_test.go
index 879943b..002af2b 100644
--- a/services/mounttable/mounttablelib/mounttable_test.go
+++ b/services/mounttable/mounttablelib/mounttable_test.go
@@ -484,7 +484,7 @@
root, _, _ := mt.Lookup(ctx, "")
g, _ := glob.Parse("...")
fCall := &fakeServerCall{}
- root.(rpc.Globber).Globber().AllGlobberX.Glob__(ctx, fCall, g)
+ root.(rpc.Globber).Globber().AllGlobber.Glob__(ctx, fCall, g)
return fCall.sendCount, nil
}
diff --git a/services/mounttable/mounttablelib/neighborhood.go b/services/mounttable/mounttablelib/neighborhood.go
index 20997cf..c0cc83b 100644
--- a/services/mounttable/mounttablelib/neighborhood.go
+++ b/services/mounttable/mounttablelib/neighborhood.go
@@ -207,11 +207,14 @@
}
addr := s[len(addressPrefix):]
ttl := time.Second * time.Duration(rr.Header().Ttl)
- addrMap[addr] = vdltime.Deadline{now.Add(ttl)}
+ addrMap[addr] = vdltime.Deadline{Time: now.Add(ttl)}
}
}
for addr, deadline := range addrMap {
- reply = append(reply, naming.MountedServer{addr, deadline})
+ reply = append(reply, naming.MountedServer{
+ Server: addr,
+ Deadline: deadline,
+ })
}
return reply
}
@@ -284,7 +287,7 @@
matcher := g.Head()
for k, n := range nh.neighbors() {
if matcher.Match(k) {
- sender.Send(naming.GlobReplyEntry{naming.MountEntry{Name: k, Servers: n, ServesMountTable: true}})
+ sender.Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: k, Servers: n, ServesMountTable: true}})
}
}
return nil
@@ -293,7 +296,7 @@
if neighbor == nil {
return verror.New(naming.ErrNoSuchName, ctx, ns.elems[0])
}
- sender.Send(naming.GlobReplyEntry{naming.MountEntry{Name: "", Servers: neighbor, ServesMountTable: true}})
+ sender.Send(naming.GlobReplyEntry{Value: naming.MountEntry{Name: "", Servers: neighbor, ServesMountTable: true}})
return nil
default:
return verror.New(naming.ErrNoSuchName, ctx, ns.elems)
diff --git a/services/mounttable/mounttablelib/serverlist.go b/services/mounttable/mounttablelib/serverlist.go
index 65f1061..d5b8084 100644
--- a/services/mounttable/mounttablelib/serverlist.go
+++ b/services/mounttable/mounttablelib/serverlist.go
@@ -120,7 +120,7 @@
s := e.Value.(*server)
ms := naming.MountedServer{
Server: s.oa,
- Deadline: vdltime.Deadline{s.expires},
+ Deadline: vdltime.Deadline{Time: s.expires},
}
slice = append(slice, ms)
}
diff --git a/services/mounttable/mounttablelib/serverlist_test.go b/services/mounttable/mounttablelib/serverlist_test.go
index c061f00..3f8c56a 100644
--- a/services/mounttable/mounttablelib/serverlist_test.go
+++ b/services/mounttable/mounttablelib/serverlist_test.go
@@ -48,7 +48,7 @@
if got, want := sl.copyToSlice(), []naming.MountedServer{
{
Server: "endpoint:dfgsfdg@@",
- Deadline: vdltime.Deadline{now.Add(15 * time.Second)},
+ Deadline: vdltime.Deadline{Time: now.Add(15 * time.Second)},
},
}; !reflect.DeepEqual(got, want) {
t.Errorf("Got %v, want %v", got, want)
diff --git a/services/role/roled/internal/glob.go b/services/role/roled/internal/glob.go
index 88b0478..12735e0 100644
--- a/services/role/roled/internal/glob.go
+++ b/services/role/roled/internal/glob.go
@@ -29,7 +29,7 @@
}
for c := range n.children {
if m.Match(c) {
- call.SendStream().Send(naming.GlobChildrenReplyName{c})
+ call.SendStream().Send(naming.GlobChildrenReplyName{Value: c})
}
}
return nil
diff --git a/services/role/roled/internal/role.go b/services/role/roled/internal/role.go
index 5e4aadc..5f4c733 100644
--- a/services/role/roled/internal/role.go
+++ b/services/role/roled/internal/role.go
@@ -129,7 +129,11 @@
if err != nil {
return security.Blessings{}, verror.Convert(verror.ErrInternal, ctx, err)
}
- thirdParty, err := security.NewPublicKeyCaveat(principal.PublicKey(), dischargerLocation, security.ThirdPartyRequirements{true, true, true}, loggingCaveat)
+ thirdParty, err := security.NewPublicKeyCaveat(principal.PublicKey(), dischargerLocation, security.ThirdPartyRequirements{
+ ReportServer: true,
+ ReportMethod: true,
+ ReportArguments: true,
+ }, loggingCaveat)
if err != nil {
return security.Blessings{}, verror.Convert(verror.ErrInternal, ctx, err)
}
diff --git a/services/wspr/internal/principal/principal_test.go b/services/wspr/internal/principal/principal_test.go
index 189c052..64cb612 100644
--- a/services/wspr/internal/principal/principal_test.go
+++ b/services/wspr/internal/principal/principal_test.go
@@ -178,12 +178,18 @@
if err != nil {
t.Fatalf("NewPrincipalManager failed: %v", err)
}
+
googleAccount := "fred/jim@gmail.com"
+ googleBlessings := accountBlessing(root, googleAccount)
+
+ if err := m.AddAccount(googleAccount, googleBlessings); err != nil {
+ t.Errorf("AddAccount(%v, %v) failed: %v", googleAccount, googleBlessings, err)
+ }
// Test with unknown origin.
unknownOrigin := "http://unknown.com"
if m.OriginHasAccount(unknownOrigin) {
- fmt.Errorf("Expected m.OriginHasAccount(%v) to be false but it was true.", unknownOrigin)
+ t.Errorf("Expected m.OriginHasAccount(%v) to be false but it was true.", unknownOrigin)
}
// Test with no expiration caveat.
@@ -191,15 +197,15 @@
methodCav, err := security.NewMethodCaveat("Foo")
if err != nil {
- fmt.Errorf("security.MethodCaveat failed: %v", err)
+ t.Errorf("security.MethodCaveat failed: %v", err)
}
if err := m.AddOrigin(origin1, googleAccount, []security.Caveat{methodCav}, nil); err != nil {
- fmt.Errorf("AddOrigin failed: %v", err)
+ t.Errorf("AddOrigin failed: %v", err)
}
if !m.OriginHasAccount(origin1) {
- fmt.Errorf("Expected m.OriginHasAccount(%v) to be true but it was false.", origin1)
+ t.Errorf("Expected m.OriginHasAccount(%v) to be true but it was false.", origin1)
}
// Test with expiration caveat in the future.
@@ -208,15 +214,15 @@
futureExpCav, err := security.NewExpiryCaveat(futureTime)
if err != nil {
- fmt.Errorf("security.NewExpiryCaveat(%v) failed: %v", futureTime, err)
+ t.Errorf("security.NewExpiryCaveat(%v) failed: %v", futureTime, err)
}
if err := m.AddOrigin(origin2, googleAccount, []security.Caveat{futureExpCav}, []time.Time{futureTime}); err != nil {
- fmt.Errorf("AddOrigin failed: %v", err)
+ t.Errorf("AddOrigin failed: %v", err)
}
if !m.OriginHasAccount(origin2) {
- fmt.Errorf("Expected m.OriginHasAccount(%v) to be true but it was false.", origin2)
+ t.Errorf("Expected m.OriginHasAccount(%v) to be true but it was false.", origin2)
}
// Test with expiration caveats in the past and future.
@@ -225,14 +231,14 @@
pastExpCav, err := security.NewExpiryCaveat(pastTime)
if err != nil {
- fmt.Errorf("security.NewExpiryCaveat(%v) failed: %v", pastTime, err)
+ t.Errorf("security.NewExpiryCaveat(%v) failed: %v", pastTime, err)
}
if err := m.AddOrigin(origin3, googleAccount, []security.Caveat{futureExpCav, pastExpCav}, []time.Time{futureTime, pastTime}); err != nil {
- fmt.Errorf("AddOrigin failed: %v", err)
+ t.Errorf("AddOrigin failed: %v", err)
}
if m.OriginHasAccount(origin3) {
- fmt.Errorf("Expected m.OriginHasAccount(%v) to be false but it was true.", origin3)
+ t.Errorf("Expected m.OriginHasAccount(%v) to be false but it was true.", origin3)
}
}
diff --git a/services/wspr/internal/rpc/server/invoker.go b/services/wspr/internal/rpc/server/invoker.go
index 9e6e40c..ae5c48a 100644
--- a/services/wspr/internal/rpc/server/invoker.go
+++ b/services/wspr/internal/rpc/server/invoker.go
@@ -84,7 +84,7 @@
if i.globFunc == nil {
return nil
}
- return &rpc.GlobState{AllGlobberX: i}
+ return &rpc.GlobState{AllGlobber: i}
}
func (i *invoker) Glob__(ctx *context.T, call rpc.GlobServerCall, g *glob.Glob) error {