Documentation ¶
Index ¶
- Constants
- func CreateNewContextPacketId(ctx context.Context) (int64, context.Context)
- type P2pServer
- func (p *P2pServer) AddConnConntextKey(key interface{})
- func (p *P2pServer) BuildBadVersionMsg(version uint16, cmd uint8, minAppVer uint16) []byte
- func (p *P2pServer) CanConnectToSp(p2pAddress string) bool
- func (p *P2pServer) CleanUpConnMap(fileHash string)
- func (p *P2pServer) ClearBufferedSpConns()
- func (p *P2pServer) ConfirmOptSP(ctx context.Context, spNetworkAddr string)
- func (p *P2pServer) ConnectToSP(ctx context.Context) (newConnection bool, err error)
- func (p *P2pServer) DeleteConnFromCache(key string)
- func (p *P2pServer) GetBufferedSpConns() []*cf.ClientConn
- func (p *P2pServer) GetClientConn(networkAddr string) (*cf.ClientConn, bool)
- func (p *P2pServer) GetConnectionName(conn core.WriteCloser) string
- func (p *P2pServer) GetP2PAddress() fwtypes.P2PAddress
- func (p *P2pServer) GetP2PPublicKey() fwcryptotypes.PubKey
- func (p *P2pServer) GetP2pServer() *core.Server
- func (p *P2pServer) GetPPInfo() *protos.PPBaseInfo
- func (p *P2pServer) GetSpConn() *cf.ClientConn
- func (p *P2pServer) GetSpName() string
- func (p *P2pServer) Init() error
- func (p *P2pServer) LoadConnFromCache(key string) (*cf.ClientConn, bool)
- func (p *P2pServer) LoadRequestInfo(reqId int64, rspMsgType uint8) (uint8, bool)
- func (p *P2pServer) NewClientToAlternativeSp(ctx context.Context, server string) (*cf.ClientConn, error)
- func (p *P2pServer) NewClientToMainSp(ctx context.Context, server string) error
- func (p *P2pServer) NewClientToPp(ctx context.Context, server string, heartbeat bool) (*cf.ClientConn, error)
- func (p *P2pServer) RangeCachedConn(prefix string, rf func(k, v interface{}) bool)
- func (p *P2pServer) ReadOfflineChan() chan *offline
- func (p *P2pServer) RecordSpMaintenance(spP2pAddress string, recordTime time.Time) bool
- func (p *P2pServer) SendMessage(ctx context.Context, conn core.WriteCloser, pb proto.Message, ...) error
- func (p *P2pServer) SendMessageByCachedConn(ctx context.Context, key string, netAddr string, pb proto.Message, ...) error
- func (p *P2pServer) SendMessageToSPServer(ctx context.Context, pb proto.Message, cmd header.MsgType)
- func (p *P2pServer) SetOptionFunctions(write func(context.Context, *msg.RelayMsgBuf), read func(*msg.RelayMsgBuf), ...)
- func (p *P2pServer) SetPPServer(pp *core.Server)
- func (p *P2pServer) SignP2pMessage(signMsg []byte) ([]byte, error)
- func (p *P2pServer) SpConnValid() bool
- func (p *P2pServer) Start(ctx context.Context)
- func (p *P2pServer) StartListenServer(ctx context.Context, port string)
- func (p *P2pServer) Stop()
- func (p *P2pServer) StoreBufferedSpConn(spConn *cf.ClientConn)
- func (p *P2pServer) StoreConnToCache(key string, conn *cf.ClientConn)
- func (p *P2pServer) StoreRequestInfo(reqId int64, reqMsgType uint8)
- func (p *P2pServer) TransferSendMessageToPPServ(ctx context.Context, addr string, msgBuf *msg.RelayMsgBuf) error
- func (p *P2pServer) TransferSendMessageToSPServer(ctx context.Context, message *msg.RelayMsgBuf)
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type P2pServer ¶
type P2pServer struct { // SPMaintenanceMap stores records of SpUnderMaintenance, K - SpP2pAddress, V - lastReconnectRecord SPMaintenanceMap *utils.AutoCleanMap // contains filtered or unexported fields }
func GetP2pServer ¶
func (*P2pServer) AddConnConntextKey ¶
func (p *P2pServer) AddConnConntextKey(key interface{})
func (*P2pServer) BuildBadVersionMsg ¶ added in v0.12.0
func (*P2pServer) CanConnectToSp ¶ added in v0.12.1
func (*P2pServer) CleanUpConnMap ¶
func (*P2pServer) ClearBufferedSpConns ¶
func (p *P2pServer) ClearBufferedSpConns()
func (*P2pServer) ConfirmOptSP ¶
ConfirmOptSP connect if there is a detected optimal SP node.
func (*P2pServer) ConnectToSP ¶
ConnectToSP checks if there is a connection to an SP node. If there isn't, it attempts to create one with a random SP node.
func (*P2pServer) DeleteConnFromCache ¶
DeleteConnFromCache access function for member cachedConnMap
func (*P2pServer) GetBufferedSpConns ¶
func (p *P2pServer) GetBufferedSpConns() []*cf.ClientConn
func (*P2pServer) GetClientConn ¶
func (p *P2pServer) GetClientConn(networkAddr string) (*cf.ClientConn, bool)
func (*P2pServer) GetConnectionName ¶
func (p *P2pServer) GetConnectionName(conn core.WriteCloser) string
func (*P2pServer) GetP2PAddress ¶ added in v0.10.0
func (p *P2pServer) GetP2PAddress() fwtypes.P2PAddress
func (*P2pServer) GetP2PPublicKey ¶ added in v0.10.0
func (p *P2pServer) GetP2PPublicKey() fwcryptotypes.PubKey
func (*P2pServer) GetP2pServer ¶
func (*P2pServer) GetPPInfo ¶ added in v0.10.0
func (p *P2pServer) GetPPInfo() *protos.PPBaseInfo
func (*P2pServer) GetSpConn ¶
func (p *P2pServer) GetSpConn() *cf.ClientConn
func (*P2pServer) LoadConnFromCache ¶
func (p *P2pServer) LoadConnFromCache(key string) (*cf.ClientConn, bool)
LoadConnFromCache access function for member cachedConnMap
func (*P2pServer) LoadRequestInfo ¶ added in v0.10.0
func (*P2pServer) NewClientToAlternativeSp ¶
func (*P2pServer) NewClientToMainSp ¶
func (*P2pServer) NewClientToPp ¶
func (*P2pServer) RangeCachedConn ¶
func (*P2pServer) ReadOfflineChan ¶
func (p *P2pServer) ReadOfflineChan() chan *offline
func (*P2pServer) RecordSpMaintenance ¶
RecordSpMaintenance return boolean flag of switching to new SP
func (*P2pServer) SendMessage ¶
func (*P2pServer) SendMessageByCachedConn ¶
func (*P2pServer) SendMessageToSPServer ¶
func (*P2pServer) SetOptionFunctions ¶ added in v0.12.0
func (p *P2pServer) SetOptionFunctions(write func(context.Context, *msg.RelayMsgBuf), read func(*msg.RelayMsgBuf), handle func(context.Context, *msg.RelayMsgBuf))
func (*P2pServer) SetPPServer ¶
func (*P2pServer) SignP2pMessage ¶ added in v0.10.0
func (*P2pServer) SpConnValid ¶
func (*P2pServer) StartListenServer ¶
func (*P2pServer) StoreBufferedSpConn ¶
func (p *P2pServer) StoreBufferedSpConn(spConn *cf.ClientConn)
func (*P2pServer) StoreConnToCache ¶
func (p *P2pServer) StoreConnToCache(key string, conn *cf.ClientConn)
StoreConnToCache access function for member cachedConnMap
func (*P2pServer) StoreRequestInfo ¶ added in v0.10.0
func (*P2pServer) TransferSendMessageToPPServ ¶
func (*P2pServer) TransferSendMessageToSPServer ¶
func (p *P2pServer) TransferSendMessageToSPServer(ctx context.Context, message *msg.RelayMsgBuf)
Click to show internal directories.
Click to hide internal directories.