// New creates new P2P struct
168406
func New(identity peer.ID, peerHost p2phost.Host, peerstore pstore.Peerstore) *P2P {
	return &P2P{
		identity:  identity,
		peerHost:  peerHost,
		peerstore: peerstore,

		ListenersLocal: newListenersLocal(),
		ListenersP2P:   newListenersP2P(peerHost),

		Streams: &StreamRegistry{
			Streams:     map[uint64]*Stream{},
			ConnManager: peerHost.ConnManager(),
			conns:       map[peer.ID]int{},
		},
	}
}
967277
func NewPeer(p *p2p.Peer, rw p2p.MsgReadWriter, spec *Spec) *Peer {
	return &Peer{
		Peer: p,
		rw:   rw,
		spec: spec,
	}
}
998306
func New(ccp ccprovider.ChaincodeProvider, sccp sysccprovider.SystemChaincodeProvider, aclProvider aclmgmt.ACLProvider) *PeerConfiger {
	return &PeerConfiger{
		policyChecker: policy.NewPolicyChecker(
			peer.NewChannelPolicyManagerGetter(),
			mgmt.GetLocalMSP(),
			mgmt.NewLocalMSPPrincipalGetter(),
		),
		configMgr:   peer.NewConfigSupport(),
		ccp:         ccp,
		sccp:        sccp,
		aclProvider: aclProvider,
	}
}
180484
func New(dispatcher service.Dispatcher, context context.Client, channelID string, opts ...options.Opt) *PeerResolver {
	params := defaultParams(context, channelID)
	options.Apply(params, opts)

	mspID := context.Identifier().MSPID

	logger.Debugf("Creating new PreferOrg peer resolver with options: MSP ID [%s]", mspID)

	return &PeerResolver{
		params:              params,
		mspID:               mspID,
		blockHeightResolver: minblockheight.New(dispatcher, context, channelID, opts...),
	}
}
11830
func New() (clone *Clone) {
	clone = &Clone{}
	clone.pipe, _ = zmq.NewSocket(zmq.PAIR)
	pipename := fmt.Sprint("inproc://pipe", pipe_nmb)
	pipe_nmb++
	clone.pipe.Bind(pipename)
	go clone_agent(pipename)
	return
}
24095
func New(s interface{}) *Struct {
	return &Struct{
		raw:     s,
		value:   strctVal(s),
		TagName: DefaultTagName,
	}
}
1239384
func New(transport peer.Transport, opts ...ListOption) *List {
	options := defaultListOptions
	for _, opt := range opts {
		opt.apply(&options)
	}

	if options.source == nil {
		options.source = rand.NewSource(time.Now().UnixNano())
	}

	plOpts := []peerlist.ListOption{
		peerlist.Capacity(options.capacity),
		peerlist.NoShuffle(),
	}

	return &List{
		List: peerlist.New(
			"random",
			transport,
			newRandomList(options.capacity, options.source),
			plOpts...,
		),
	}
}
578174
func New() *FileSystem {
	return &FileSystem{
		mutex: &sync.RWMutex{},
		root:  node{"", map[string]node{}, dirStat(""), ""},
	}
}
1302736
func New(
	ctx context.Context,
	host, user, pass, group string,
	opts *ClientOptions) (Client, error) {

	if host == "" || user == "" || pass == "" {
		return nil, errNewClient
	}

	c := &client{
		host: host,
		user: user,
		grup: group,
		auth: fmtAuthHeaderVal(user, pass),
		volp: defaultVolumesPath,
	}

	c.http = &http.Client{}

	if opts != nil {
		if opts.VolumesPath != "" {
			c.volp = opts.VolumesPath
		}

		if opts.Timeout != 0 {
			c.http.Timeout = opts.Timeout
		}

		if opts.Insecure {
			c.http.Transport = &http.Transport{
				TLSClientConfig: &tls.Config{
					InsecureSkipVerify: true,
				},
			}
		}
	}

	resp := &apiVerResponse{}
	if err := c.Get(ctx, "/platform/latest", "", nil, nil, resp); err != nil &&
		!strings.HasPrefix(err.Error(), "json: ") {
		return nil, err
	}

	if resp.Latest != nil {
		i, err := strconv.ParseUint(*resp.Latest, 10, 8)
		if err != nil {
			return nil, err
		}
		c.apiv = uint8(i)
	} else {
		c.apiv = 2
	}

	return c, nil
}
1036386
func New(path string) *Node {
	return &Node{path: path, vpaths: make(map[string]bool)}
}
968791
func New(key string) *Client {
	config := ClientConfig{
		Scheme: defaultScheme,
		Host:   defaultHost,
		Port:   defaultPort,
		Key:    key,
	}
	return NewWithConfig(config)
}
1133857
func New(apiKey, apiSecret string) *Bittrex {
	client := NewClient(apiKey, apiSecret)
	return &Bittrex{client}
}
709524
func New(ctx context.Context, config shim.Config, opt Opt) (*Client, error) {
	s, c, err := opt(ctx, config)
	if err != nil {
		return nil, err
	}
	return &Client{
		ShimService: s,
		c:           c,
		exitCh:      make(chan struct{}),
	}, nil
}
140630
func New(transport peer.Transport, opts ...newrr.ListOption) *newrr.List {
	return newrr.New(transport, opts...)
}
179832
func New(config *Config) *DHT {
	if config == nil {
		config = NewStandardConfig()
	}

	node, err := newNode(randomString(20), config.Network, config.Address)
	if err != nil {
		panic(err)
	}

	d := &DHT{
		Config:       config,
		node:         node,
		blackList:    newBlackList(config.BlackListMaxSize),
		packets:      make(chan packet, config.PacketJobLimit),
		workerTokens: make(chan struct{}, config.PacketWorkerLimit),
	}

	for _, ip := range config.BlockedIPs {
		d.blackList.insert(ip, -1)
	}

	go func() {
		for _, ip := range getLocalIPs() {
			d.blackList.insert(ip, -1)
		}

		ip, err := getRemoteIP()
		if err != nil {
			d.blackList.insert(ip, -1)
		}
	}()

	return d
}
968590
func New(dir string) (blobserver.Storage, error) {
	var maxSize int64
	if ok, _ := IsDir(dir); ok {
		// TODO: detect existing max size from size of files, if obvious,
		// and set maxSize to that?
	}
	return newStorage(dir, maxSize, nil)
}
1217051
func New(maxBytes int64, cache, origin blobserver.Storage) *Storage {
	sto := &Storage{
		origin:        origin,
		cache:         cache,
		lru:           lru.NewUnlocked(0),
		maxCacheBytes: maxBytes,
	}
	return sto
}