Documentation
¶
Overview ¶
* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.
* Copyright (C) 2018 The ontology Authors * This file is part of The ontology library. * * The ontology is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ontology is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with The ontology. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- func NewListener(port uint16, config *config.P2PNodeConfig) (net.Listener, error)
- type Conn
- type ConnCtrlOption
- func (self ConnCtrlOption) MaxInBound(n uint) ConnCtrlOption
- func (self ConnCtrlOption) MaxInBoundPerIp(n uint) ConnCtrlOption
- func (self ConnCtrlOption) MaxOutBound(n uint) ConnCtrlOption
- func (self ConnCtrlOption) ReservedOnly(peers []string) ConnCtrlOption
- func (self ConnCtrlOption) WithDialer(dialer Dialer) ConnCtrlOption
- type ConnectController
- func (self *ConnectController) AcceptConnect(conn net.Conn) (*peer.PeerInfo, net.Conn, error)
- func (self *ConnectController) Connect(addr string) (*peer.PeerInfo, net.Conn, error)
- func (self *ConnectController) InboundsCount() uint
- func (self *ConnectController) OutboundsCount() uint
- func (self *ConnectController) OwnAddress() string
- type Dialer
Constants ¶
const INBOUND_INDEX = 0
const OUTBOUND_INDEX = 1
Variables ¶
This section is empty.
Functions ¶
func NewListener ¶
Types ¶
type ConnCtrlOption ¶
type ConnCtrlOption struct { MaxConnOutBound uint MaxConnInBound uint MaxConnInBoundPerIP uint ReservedPeers []string // enabled if not empty // contains filtered or unexported fields }
func ConnCtrlOptionFromConfig ¶
func ConnCtrlOptionFromConfig(config *config.P2PNodeConfig) (option ConnCtrlOption, err error)
func NewConnCtrlOption ¶
func NewConnCtrlOption() ConnCtrlOption
func (ConnCtrlOption) MaxInBound ¶
func (self ConnCtrlOption) MaxInBound(n uint) ConnCtrlOption
func (ConnCtrlOption) MaxInBoundPerIp ¶
func (self ConnCtrlOption) MaxInBoundPerIp(n uint) ConnCtrlOption
func (ConnCtrlOption) MaxOutBound ¶
func (self ConnCtrlOption) MaxOutBound(n uint) ConnCtrlOption
func (ConnCtrlOption) ReservedOnly ¶
func (self ConnCtrlOption) ReservedOnly(peers []string) ConnCtrlOption
func (ConnCtrlOption) WithDialer ¶
func (self ConnCtrlOption) WithDialer(dialer Dialer) ConnCtrlOption
type ConnectController ¶
type ConnectController struct { ConnCtrlOption // contains filtered or unexported fields }
func NewConnectController ¶
func NewConnectController(peerInfo *peer.PeerInfo, keyid *common.PeerKeyId, option ConnCtrlOption) *ConnectController
func (*ConnectController) AcceptConnect ¶
func (*ConnectController) Connect ¶
Connect used to connect net address under sync or cons mode need call Peer.Close to clean up resource.
func (*ConnectController) InboundsCount ¶
func (self *ConnectController) InboundsCount() uint
func (*ConnectController) OutboundsCount ¶
func (self *ConnectController) OutboundsCount() uint
func (*ConnectController) OwnAddress ¶
func (self *ConnectController) OwnAddress() string