Documentation
¶
Overview ¶
Package p2p is a service to process and return peer-to-peer connection links and delegate messages
Index ¶
- type Service
- func (s *Service) AddDelegate(delegate messages.Delegate)
- func (s *Service) AddLink(link *p2p.Link)
- func (s *Service) Check() (delegates []messages.Delegate)
- func (s *Service) Connected(agentType int, ip string) (*p2p.Link, bool)
- func (s *Service) Delete(id uuid.UUID)
- func (s *Service) GetDelegates() []messages.Delegate
- func (s *Service) GetLink(id uuid.UUID) (*p2p.Link, error)
- func (s *Service) Handle(delegates []messages.Delegate)
- func (s *Service) List() (list string)
- func (s *Service) Refresh() (list string)
- func (s *Service) Remove(id uuid.UUID) error
- func (s *Service) UpdateConnection(id uuid.UUID, conn interface{}, remote net.Addr) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the structure used to interact with Link and Delegate objects
func NewP2PService ¶
func NewP2PService() *Service
NewP2PService is a factory to create a Service object for interacting with Link and Delegate message objects
func (*Service) AddDelegate ¶
func (s *Service) AddDelegate(delegate messages.Delegate)
AddDelegate takes the provided delegate message and adds it to outgoing message channel to be sent to the Merlin server
func (*Service) Check ¶
func (s *Service) Check() (delegates []messages.Delegate)
Check does not block and returns all delegate messages in the out channel, if any
func (*Service) Connected ¶
Connected determines if this Agent is already connected to the target IP address and port and returns it if it is
func (*Service) Delete ¶
Delete removes the peer-to-peer link from the repository without trying to gracefully close the connection
func (*Service) GetDelegates ¶
func (s *Service) GetDelegates() []messages.Delegate
GetDelegates blocks waiting for a delegate message that needs to be sent to the parent Agent
func (*Service) GetLink ¶
GetLink finds the Link by the provided id from the repository and returns it
func (*Service) Handle ¶
func (s *Service) Handle(delegates []messages.Delegate)
Handle takes in a list of incoming Delegate messages to this parent Agent and sends it to the child or linked Agent
func (*Service) List ¶
List returns a numbered list of peer-to-peer Links that exist each seperated by a new line
func (*Service) Refresh ¶
Refresh sends an empty delegate message to the server for each peer-to-peer Link in the repository to update the server with this Agent's links