本文整理汇总了Golang中github.com/jddixon/xlNode_go.Node.GetEndPoint方法的典型用法代码示例。如果您正苦于以下问题:Golang Node.GetEndPoint方法的具体用法?Golang Node.GetEndPoint怎么用?Golang Node.GetEndPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jddixon/xlNode_go.Node
的用法示例。
在下文中一共展示了Node.GetEndPoint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewEphServer
func NewEphServer() (ms *EphServer, err error) {
// Create an XLattice node with quasi-random parameters including
// low-quality keys and an endPoint in 127.0.0.1, localhost.
var (
ckPriv, skPriv *rsa.PrivateKey
rn *RegNode
ep *xt.TcpEndPoint
node *xn.Node
reg *Registry
server *RegServer
)
rng := xr.MakeSimpleRNG()
name := rng.NextFileName(16)
idBuf := make([]byte, xu.SHA1_BIN_LEN)
rng.NextBytes(idBuf)
lfs := "tmp/" + hex.EncodeToString(idBuf)
id, err := xi.New(nil)
if err == nil {
// XXX cheap keys, too weak for any serious use
ckPriv, err = rsa.GenerateKey(rand.Reader, 1024)
if err == nil {
skPriv, err = rsa.GenerateKey(rand.Reader, 1024)
}
}
if err == nil {
ep, err = xt.NewTcpEndPoint("127.0.0.1:0")
eps := []xt.EndPointI{ep}
if err == nil {
node, err = xn.New(name, id, lfs, ckPriv, skPriv, nil, eps, nil)
if err == nil {
err = node.OpenAcc() // so acceptors are now live
if err == nil {
rn, err = NewRegNode(node, ckPriv, skPriv)
if err == nil {
// DEBUG
if rn == nil {
fmt.Println("regNode is NIL!\n")
} else {
fmt.Printf("eph server listening on %s\n",
rn.GetAcceptor(0).String())
}
// END
// a registry with no clusters and no logger
opt := &RegOptions{
EndPoint: ep, // not used
Ephemeral: true,
GlobalEndPoint: node.GetEndPoint(0),
Lfs: lfs, // redundant (is in node's BaseNode)
Logger: nil,
K: DEFAULT_K,
M: DEFAULT_M,
}
reg, err = NewRegistry(nil, rn, opt)
if err == nil {
server, err = NewRegServer(reg, true, 1)
if err == nil {
ms = &EphServer{
acc: rn.GetAcceptor(0),
Server: server,
}
}
}
}
}
}
}
}
return
}