// New : creates a new instance of API func New(contentKey, routingKey bc.KeyPair) *Node { // create node node := new(Node) // init assorted other node.channels = make(map[string]*api.ChannelPriv) node.config = make(map[string]string) node.contacts = make(map[string]*api.Contact) node.peers = make(map[string]*api.Peer) node.profiles = make(map[string]*api.ProfilePriv) // set crypto modes node.contentKey = contentKey node.routingKey = routingKey // setup chans node.in = make(chan api.Msg) node.out = make(chan api.Msg) node.err = make(chan api.Msg) // setup default router node.router = router.NewDefaultRouter() return node }
// New : creates a new instance of API func New(contentKey, routingKey bc.KeyPair) *Node { // create node node := new(Node) // init channel key map node.channelKeys = make(map[string]bc.KeyPair) // set crypto modes node.contentKey = contentKey node.routingKey = routingKey // setup chans node.in = make(chan api.Msg) node.out = make(chan api.Msg) node.err = make(chan api.Msg) // setup default router node.router = router.NewDefaultRouter() return node }