示例#1
0
/* Initializes a new ChanConnManager
 *
 * Arguments:
 * 	goDir = the GoDirectory to use for creating new connections. Enter nil
 * 		to create a new one.
 * 	key = the public key of the owner of this manager
 *
 * Returns:
 * 	An initialized ChanConnManager
 */
func (gcm *ChanConnManager) Init(key abstract.Point, goDir *coconet.GoDirectory) *ChanConnManager {
	gcm.pubKey = key
	gcm.peerMap = make(map[string]*coconet.GoConn)
	if goDir == nil {
		gcm.dir = coconet.NewGoDirectory()
	} else {
		gcm.dir = goDir
	}
	return gcm
}
示例#2
0
package insure

import (
	"testing"

	"github.com/dedis/crypto/abstract"
	"github.com/dedis/crypto/config"
	"github.com/dedis/crypto/random"

	"github.com/dedis/prifi/coconet"
	"github.com/dedis/prifi/connMan"
)

var goDir = coconet.NewGoDirectory()

// Variables for the server to take out the policy.
var keyPairT = produceKeyPairT()
var goConn = produceChanConn(keyPairT)

// Alter this to easily scale the number of servers to test with. This
// represents the number of other servers waiting to approve policies.
var numServers int = 10

// Variables for the servers to accept the policy
var serverKeys = produceServerKeys()
var insurerList = produceInsuredList()
var connectionManagers = produceGoConnArray()
var setupOkay = setupConn()

func produceKeyPairT() *config.KeyPair {
	keyPair := new(config.KeyPair)