Skip to content

Commit 854ebf3

Browse files
committed
Fixup: Make prefixes public and constant
1 parent e954394 commit 854ebf3

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

go/runtime/host/protocol/types.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ type RuntimeCapabilityTEEUpdateEndorsementRequest struct {
266266
EndorsedCapabilityTEE node.EndorsedCapabilityTEE `json:"ect"` //nolint: misspell
267267
}
268268

269+
const (
270+
// PeerIDPrefixLocal is the peer ID prefix for local EnclaveRPC calls.
271+
PeerIDPrefixLocal = "local:"
272+
// PeerIDPrefixP2P is the peer ID prefix for P2P EnclaveRPC calls.
273+
PeerIDPrefixP2P = "p2p:"
274+
)
275+
269276
// RuntimeRPCCallRequest is a worker RPC call request message body.
270277
type RuntimeRPCCallRequest struct {
271278
// Request.

go/runtime/registry/handler_rofl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (rh *roflHostHandler) getLocalStorageKey(key []byte) []byte {
8888
// getLocalEnclaveRPCPeerID returns the peer ID for local EnclaveRPC calls.
8989
func (rh *roflHostHandler) getLocalEnclaveRPCPeerID() []byte {
9090
componentID, _ := rh.id.MarshalText()
91-
return append([]byte("local:"), componentID...)
91+
return append([]byte(protocol.PeerIDPrefixLocal), componentID...)
9292
}
9393

9494
// Implements protocol.Handler.

go/worker/keymanager/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func (w *Worker) CallEnclave(ctx context.Context, data []byte, kind enclaverpc.K
186186
RuntimeRPCCallRequest: &protocol.RuntimeRPCCallRequest{
187187
Request: data,
188188
Kind: kind,
189-
PeerID: append([]byte("p2p:"), []byte(peerID)...),
189+
PeerID: append([]byte(protocol.PeerIDPrefixP2P), []byte(peerID)...),
190190
},
191191
}
192192

0 commit comments

Comments
 (0)