Documentation
¶
Index ¶
- Constants
- type ConnectionState
- type Info
- func (this *Info) CloseConnection()
- func (this *Info) SendFullMedicineRequest()
- func (this *Info) SendGoodbye()
- func (this *Info) SendHello(message *protobuf.Hello)
- func (this *Info) SendMedicineOffer(message *protobuf.MedicineOffer)
- func (this *Info) SendMessageBroadcast(message *protobuf.MessageBroadcast)
- func (this *Info) SendMessageFrame(payloadBytes []byte, payloadType PayloadType)
- func (this *Info) SendMessageFramePacked(frame protobuf.MessageFrame)
- func (this *Info) SendPeerRequest()
- func (this *Info) SendPeerResponse(message protobuf.PeerResponse)
- func (this *Info) SendRequestResource(message *protobuf.RequestBroadcast)
- type MessageDescriptor
- type Node
- func (this *Node) BroadcastSender()
- func (this *Node) Connect(ip net.IP, port uint32)
- func (this *Node) HandleConnection(info *Info)
- func (this *Node) HandleMessages()
- func (this *Node) Init(localCertFile, localKeyFile, caCertFile, serverName string, ...)
- func (this *Node) Listen()
- func (this *Node) PeerDiscovery()
- func (this *Node) TidyMedicineOffersRoutine()
- type PayloadType
- type PeerPunish
Constants ¶
View Source
const DeMedVersion = "alpha_0.1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionState ¶
type ConnectionState byte
const ( Closed ConnectionState = 0b000 Established ConnectionState = 0b001 Ready ConnectionState = 0b010 )
type Info ¶
type Info struct {
RemotePeer *net.TCPAddr
Peer *net.TCPAddr
Socket net.Conn
LastSeen time.Time
ConnectionState ConnectionState
RemotePubKey rsa.PublicKey
// contains filtered or unexported fields
}
func (*Info) CloseConnection ¶
func (this *Info) CloseConnection()
func (*Info) SendFullMedicineRequest ¶
func (this *Info) SendFullMedicineRequest()
func (*Info) SendGoodbye ¶
func (this *Info) SendGoodbye()
func (*Info) SendMedicineOffer ¶
func (this *Info) SendMedicineOffer(message *protobuf.MedicineOffer)
func (*Info) SendMessageBroadcast ¶
func (this *Info) SendMessageBroadcast(message *protobuf.MessageBroadcast)
func (*Info) SendMessageFrame ¶
func (this *Info) SendMessageFrame(payloadBytes []byte, payloadType PayloadType)
func (*Info) SendMessageFramePacked ¶
func (this *Info) SendMessageFramePacked(frame protobuf.MessageFrame)
func (*Info) SendPeerRequest ¶
func (this *Info) SendPeerRequest()
func (*Info) SendPeerResponse ¶
func (this *Info) SendPeerResponse(message protobuf.PeerResponse)
func (*Info) SendRequestResource ¶
func (this *Info) SendRequestResource(message *protobuf.RequestBroadcast)
type MessageDescriptor ¶
type MessageDescriptor struct {
// contains filtered or unexported fields
}
type Node ¶
type Node struct {
Clients list.List
PeerBlackList list.List
PeerBlackListMutex sync.Mutex
CurrentMedicineOffersMutex sync.Mutex
CurrentMedicineOffers map[string]protobuf.MedicineOffer_Medicine
CurrentMedicineOffersRelays map[string]int
IncomingMessageQueue chan *MessageDescriptor
BroadcastMessageQueue chan *protobuf.MessageFrame
// contains filtered or unexported fields
}
var CurrentNode *Node
func (*Node) BroadcastSender ¶
func (this *Node) BroadcastSender()
func (*Node) HandleConnection ¶
func (*Node) HandleMessages ¶
func (this *Node) HandleMessages()
func (*Node) PeerDiscovery ¶
func (this *Node) PeerDiscovery()
func (*Node) TidyMedicineOffersRoutine ¶
func (this *Node) TidyMedicineOffersRoutine()
type PayloadType ¶
type PayloadType uint32
const ( Hello PayloadType = 0 Goodbye PayloadType = 1 MessageBroadcast PayloadType = 2 RequestResource PayloadType = 3 PeerRequest PayloadType = 4 PeerResponse PayloadType = 5 MedicineOffer PayloadType = 6 FullMedicineRequest PayloadType = 7 )
type PeerPunish ¶
Click to show internal directories.
Click to hide internal directories.