common

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtensionID = getPrefixedExtensionID([]int{1, 1})

ExtensionID .

Functions

func PreferServerCipherSuites

func PreferServerCipherSuites() bool

PreferServerCipherSuites select the cipher suites based on your hardware environment

Types

type CertIdPeerIdMapper

type CertIdPeerIdMapper struct {
	// contains filtered or unexported fields
}

CertIdPeerIdMapper mapped cert id with peer id.

func NewCertIdPeerIdMapper

func NewCertIdPeerIdMapper(logger protocol.Logger) *CertIdPeerIdMapper

NewCertIdPeerIdMapper create a new CertIdPeerIdMapper instance.

func (*CertIdPeerIdMapper) Add

func (c *CertIdPeerIdMapper) Add(certId string, peerId string)

Add a record mapping cert id with peer id.

func (*CertIdPeerIdMapper) FindPeerIdByCertId

func (c *CertIdPeerIdMapper) FindPeerIdByCertId(certId string) (string, error)

FindPeerIdByCertId will return a peer id if the given cert id has mapped with a peer id .

func (*CertIdPeerIdMapper) RemoveByPeerId

func (c *CertIdPeerIdMapper) RemoveByPeerId(peerId string)

RemoveByPeerId remove all records mapped with given peerId.

type MemberStatusValidator

type MemberStatusValidator struct {
	// contains filtered or unexported fields
}

MemberStatusValidator is a validator for validating member status.

func NewMemberStatusValidator

func NewMemberStatusValidator() *MemberStatusValidator

NewMemberStatusValidator . @Description: create a new MemberStatusValidator instance. @return *MemberStatusValidator

func (*MemberStatusValidator) AddAC

func (v *MemberStatusValidator) AddAC(chainId string, ac protocol.AccessControlProvider)

AddAC . @Description: Add access control of chain to validator. @receiver v @param chainId @param ac

func (*MemberStatusValidator) AddPeerId

func (v *MemberStatusValidator) AddPeerId(pid string)

AddPeerId . @Description: Add a pid to blocked list. @receiver v @param pid

func (*MemberStatusValidator) ContainsPeerId

func (v *MemberStatusValidator) ContainsPeerId(pid string) bool

ContainsPeerId . @Description: return whether pid given exist in blocked list. @receiver v @param pid @return bool

func (*MemberStatusValidator) RemovePeerId

func (v *MemberStatusValidator) RemovePeerId(pid string)

RemovePeerId . @Description: @receiver v @param pid

func (*MemberStatusValidator) ValidateMemberStatus

func (v *MemberStatusValidator) ValidateMemberStatus(members []*pbac.Member) ([]string, bool, error)

ValidateMemberStatus . @Description: check the status of members. @receiver v @param members @return []string @return bool @return error

func (*MemberStatusValidator) ValidateMemberStatusWithChain

func (v *MemberStatusValidator) ValidateMemberStatusWithChain(members []*pbac.Member, chainId string) (bool, error)

ValidateMemberStatusWithChain check the status of members with the access control of the chain named chainId given.

type PeerIdChainIdsRecorder

type PeerIdChainIdsRecorder struct {
	// contains filtered or unexported fields
}

PeerIdChainIdsRecorder record the chain ids of peer .

func NewPeerIdChainIdsRecorder

func NewPeerIdChainIdsRecorder(logger protocol.Logger) *PeerIdChainIdsRecorder

NewPeerIdChainIdsRecorder . @Description: new the peerids recorder @param logger @return *PeerIdChainIdsRecorder

func (*PeerIdChainIdsRecorder) AddPeerChainId

func (pcr *PeerIdChainIdsRecorder) AddPeerChainId(peerId string, chainId string) bool

AddPeerChainId . @Description: add the chainId to the PeerIdChainIdsRecorder @receiver pcr @param peerId @param chainId @return bool

func (*PeerIdChainIdsRecorder) IsPeerBelongToChain

func (pcr *PeerIdChainIdsRecorder) IsPeerBelongToChain(peerId string, chainId string) bool

IsPeerBelongToChain . @Description: is the peer belong to the chain @receiver pcr @param peerId @param chainId @return bool

func (*PeerIdChainIdsRecorder) OnAddNotifyC

func (pcr *PeerIdChainIdsRecorder) OnAddNotifyC(onAddC chan<- string)

OnAddNotifyC . @Description: if the peer add a chain, notify the chan @receiver pcr @param onAddC

func (*PeerIdChainIdsRecorder) OnRemoveNotifyC

func (pcr *PeerIdChainIdsRecorder) OnRemoveNotifyC(onRemoveC chan<- string)

OnRemoveNotifyC . @Description: if the peer remove the chain, notify the chan @receiver pcr @param onRemoveC

func (*PeerIdChainIdsRecorder) PeerIdsOfChain

func (pcr *PeerIdChainIdsRecorder) PeerIdsOfChain(chainId string) []string

PeerIdsOfChain . @Description: all peerIds of the chain @receiver pcr @param chainId @return []string

func (*PeerIdChainIdsRecorder) PeerIdsOfNoChain

func (pcr *PeerIdChainIdsRecorder) PeerIdsOfNoChain() []string

PeerIdsOfNoChain . @Description: all peerIds not in any chain @receiver pcr @return []string

func (*PeerIdChainIdsRecorder) RemoveAllByPeerId

func (pcr *PeerIdChainIdsRecorder) RemoveAllByPeerId(peerId string) bool

RemoveAllByPeerId . @Description: remove all chainIds from the PeerIdChainIdsRecorder @receiver pcr @param peerId @return bool

func (*PeerIdChainIdsRecorder) RemovePeerChainId

func (pcr *PeerIdChainIdsRecorder) RemovePeerChainId(peerId string, chainId string) bool

RemovePeerChainId . @Description: remove the chainId from the PeerIdChainIdsRecorder @receiver pcr @param peerId @param chainId @return bool

type PeerIdPubKeyStore

type PeerIdPubKeyStore struct {
	// contains filtered or unexported fields
}

PeerIdPubKeyStore record the public key bytes of peer .

func NewPeerIdPubKeyStore

func NewPeerIdPubKeyStore(logger protocol.Logger) *PeerIdPubKeyStore

NewPeerIdPubKeyStore . @Description: @param logger @return *PeerIdPubKeyStore

func (*PeerIdPubKeyStore) GetCertByPeerId

func (p *PeerIdPubKeyStore) GetCertByPeerId(peerId string) []byte

GetCertByPeerId . @Description: get the public key by the peerId @receiver p @param peerId @return []byte

func (*PeerIdPubKeyStore) RemoveByPeerId

func (p *PeerIdPubKeyStore) RemoveByPeerId(peerId string)

RemoveByPeerId . @Description: remove the public key by the peerId @receiver p @param peerId

func (*PeerIdPubKeyStore) SetPeerPubKey

func (p *PeerIdPubKeyStore) SetPeerPubKey(peerId string, pubKey []byte)

SetPeerPubKey . @Description: Set the peer public key @receiver p @param peerId @param pubKey

func (*PeerIdPubKeyStore) StoreCopy

func (p *PeerIdPubKeyStore) StoreCopy() map[string][]byte

StoreCopy . @Description: @receiver p @return map[string][]byte

type PeerIdTlsCertStore

type PeerIdTlsCertStore struct {
	// contains filtered or unexported fields
}

PeerIdTlsCertStore record the tls cert bytes of peer .

func NewPeerIdTlsCertStore

func NewPeerIdTlsCertStore(logger protocol.Logger) *PeerIdTlsCertStore

NewPeerIdTlsCertStore . @Description: @param logger @return *PeerIdTlsCertStore

func (*PeerIdTlsCertStore) GetCertByPeerId

func (p *PeerIdTlsCertStore) GetCertByPeerId(peerId string) []byte

GetCertByPeerId . @Description: get the cert by the peerId @receiver p @param peerId @return []byte

func (*PeerIdTlsCertStore) RemoveByPeerId

func (p *PeerIdTlsCertStore) RemoveByPeerId(peerId string)

RemoveByPeerId . @Description: remove the cert by the peerId @receiver p @param peerId

func (*PeerIdTlsCertStore) SetPeerTlsCert

func (p *PeerIdTlsCertStore) SetPeerTlsCert(peerId string, tlsCert []byte)

SetPeerTlsCert . @Description: set the tls cert by the peerId @receiver p @param peerId @param tlsCert

func (*PeerIdTlsCertStore) StoreCopy

func (p *PeerIdTlsCertStore) StoreCopy() map[string][]byte

StoreCopy . @Description: @receiver p @return map[string][]byte

type StringMapList

type StringMapList struct {
	// contains filtered or unexported fields
}

StringMapList is a string list using a perfect map

func NewStringMapList

func NewStringMapList() *StringMapList

NewStringMapList . @Description: creates a StringMapList @return *StringMapList

func (*StringMapList) Add

func (b *StringMapList) Add(p string) bool

Add . @Description: @receiver b @param p @return bool

func (*StringMapList) Contains

func (b *StringMapList) Contains(p string) bool

Contains . @Description: @receiver b @param p @return bool

func (*StringMapList) List

func (b *StringMapList) List() []string

List . @Description: @receiver b @return []string

func (*StringMapList) Remove

func (b *StringMapList) Remove(p string) bool

Remove . @Description: StringMapList remove @receiver b @param p @return bool

func (*StringMapList) Size

func (b *StringMapList) Size() int

Size . @Description: @receiver b @return int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL