blob: 85357b4b13cb98e75679a73cff92b326fb136364 [file] [log] [blame]
// 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 discovery
import (
"v.io/v23/discovery"
)
type Uuid []byte
type EncryptionAlgorithm int32
type EncryptionKey []byte
const (
NoEncryption = EncryptionAlgorithm(0)
TestEncryption = EncryptionAlgorithm(1)
IbeEncryption = EncryptionAlgorithm(2)
)
type AdStatus byte
const (
AdReady = AdStatus(0) // All information is available
AdNotReady = AdStatus(1) // Not all information is available for querying against it
AdPartiallyReady = AdStatus(2) // All information except attachments is available
)
// AdInfo represents advertisement information for discovery.
type AdInfo struct {
Ad discovery.Advertisement
// Type of encryption applied to the advertisement so that it can
// only be decoded by authorized principals.
EncryptionAlgorithm EncryptionAlgorithm
// If the advertisement is encrypted, then the data required to
// decrypt it. The format of this data is a function of the algorithm.
EncryptionKeys []EncryptionKey
// Hash of the current advertisement. This does not include the fields below.
Hash AdHash
// Unix time in nanoseconds at which the advertisement was created.
TimestampNs int64
// The addresses (vanadium object names) that the advertisement directory service
// is served on. See directory.vdl.
DirAddrs []string
// Status of the current advertisement. Valid for scanned advertisements.
Status AdStatus
// TODO(jhahn): Add proximity.
// TODO(jhahn): Use proximity for Lost.
Lost bool
}
// An AdHash is a hash of an advertisement.
type AdHash [8]byte