Пример #1
0
func (s *XLSuite) makeAMemberInfo(c *C, rng *xr.PRNG) *xcl.MemberInfo {
	attrs := uint64(rng.Int63())
	bn, err := xn.NewBaseNode(
		rng.NextFileName(8),
		s.makeANodeID(c, rng),
		&s.makeAnRSAKey(c).PublicKey,
		&s.makeAnRSAKey(c).PublicKey,
		nil) // overlays
	c.Assert(err, IsNil)

	asPeer := &xn.Peer{
		BaseNode: *bn,
	}
	return &xcl.MemberInfo{
		Attrs: attrs,
		Peer:  asPeer,
	}
}
Пример #2
0
func (s *XLSuite) makeAClientInfo(c *C, rng *xr.PRNG, epCount uint32) *ClientInfo {
	attrs := uint64(rng.Int63())
	var myEnds []string
	for i := uint32(0); i < epCount; i++ {
		myEnds = append(myEnds, "127.0.0.1:0")
	}
	bn, err := xn.NewBaseNode(
		rng.NextFileName(8),
		s.makeANodeID(c, rng),
		&s.makeAnRSAKey(c).PublicKey,
		&s.makeAnRSAKey(c).PublicKey,
		nil) // overlays
	c.Assert(err, IsNil)
	return &ClientInfo{
		Attrs:    attrs,
		MyEnds:   myEnds,
		BaseNode: *bn,
	}
}
Пример #3
0
func NewClientInfo(name string, id *xi.NodeID,
	commsPubKey, sigPubKey *rsa.PublicKey, attrs uint64, myEnds []string) (
	client *ClientInfo, err error) {

	// all attrs bits are zero by default

	// DEBUG
	// fmt.Printf("NewClientInfo for server %s\n", name)
	// END
	base, err := xn.NewBaseNode(name, id, commsPubKey, sigPubKey, nil)
	if err == nil {
		client = &ClientInfo{
			Attrs:    attrs,
			MyEnds:   myEnds,
			BaseNode: *base,
		}
	}
	return
}