github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/go/apps/roughtime/agl_roughtime/config/config.go (about)

     1  // Copyright 2016 The Roughtime Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //   http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License. */
    14  
    15  // Package config contains JSON structs for encoding information about
    16  // Roughtime servers.
    17  package config
    18  
    19  // ServersJSON represents a JSON format for distributing information about
    20  // Roughtime servers.
    21  type ServersJSON struct {
    22  	Servers []Server `json:"servers"`
    23  }
    24  
    25  // Server represents a Roughtime server in a JSON configuration.
    26  type Server struct {
    27  	Name string `json:"name"`
    28  	// PublicKeyType specifies the type of the public key contained in
    29  	// |PublicKey|. Normally this will be "ed25519" but implementations
    30  	// should ignore entries with unknown key types.
    31  	PublicKeyType string          `json:"publicKeyType"`
    32  	PublicKey     []byte          `json:"publicKey"`
    33  	Addresses     []ServerAddress `json:"addresses"`
    34  }
    35  
    36  // ServerAddress represents the address of a Roughtime server in a JSON
    37  // configuration.
    38  type ServerAddress struct {
    39  	Protocol string `json:"protocol"`
    40  	// Address contains a protocol specific address. For the protocol
    41  	// "udp", the address has the form "host:port" where host is either a
    42  	// DNS name, an IPv4 literal, or an IPv6 literal in square brackets.
    43  	Address  string `json:"address"`
    44  }
    45  
    46  // Chain represents a history of Roughtime queries where each provably follows
    47  // the previous one.
    48  type Chain struct {
    49  	Links []Link `json:"links"`
    50  }
    51  
    52  // Link represents an entry in a Chain.
    53  type Link struct {
    54  	// PublicKeyType specifies the type of public key contained in
    55  	// |PublicKey|. See the same field in |Server| for details.
    56  	PublicKeyType string `json:"publicKeyType"`
    57  	PublicKey     []byte `json:"serverPublicKey"`
    58  	// NonceOrBlind contains either the full nonce (only for the first
    59  	// |Link| in a |Chain|) or else contains a blind value that is combined
    60  	// with the previous reply to make the next nonce. In either case, the
    61  	// value is 64 bytes long.
    62  	NonceOrBlind []byte `json:"nonceOrBlind"`
    63  	// Reply contains the reply from the server.
    64  	Reply []byte `json:"reply"`
    65  }