Documentation ¶
Index ¶
- type Driver
- type MockDriver
- type NodeDriver
- func (d *NodeDriver) Disable()
- func (d *NodeDriver) Drive(ctx context.Context)
- func (d *NodeDriver) Enable()
- func (d *NodeDriver) FindServerIDWithPeerID(res *protocol.PeerGraphResponse) protocol.ServerID
- func (d *NodeDriver) OnForward(_ *relay.Client, typ message.PacketType, msg proto.Message) error
- func (d *NodeDriver) OnFragment(data []byte)
- func (d *NodeDriver) OnProbeResponse(_ *relay.Client, _ message.PacketType, msg proto.Message) error
- func (d *NodeDriver) OnSyncPeer(_ *relay.Client, _ message.PacketType, msg proto.Message) error
- func (d *NodeDriver) Preflight() error
- func (d *NodeDriver) SetPeerID(id protocol.PeerID)
- func (d *NodeDriver) Summarize() *Summary
- func (d *NodeDriver) Terminate()
- type Profile
- type Summary
- type SummaryChangedCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { tunnel.FragmentCallback // Preflight initializes the driver state and check whether can the driver go forward. Preflight() error // Drive starts the driver and serve the application traffics. Drive(ctx context.Context) // Enable enables the driver to serve the application. Enable() // Disable disables the driver to serve the application and all packets // will be dropped if the device in disabled status. Disable() // Summarize summarizes the driver current state and returns the state and // mesh summary. Summarize() *Summary // Terminate closes the PairMesh engine. Terminate() }
type MockDriver ¶
type MockDriver struct {
NodeDriver
}
MockDriver is a wrapper of NodeDriver for testing use.
func (*MockDriver) SetPeerID ¶
func (d *MockDriver) SetPeerID(id protocol.PeerID)
type NodeDriver ¶
type NodeDriver struct {
// contains filtered or unexported fields
}
NodeDriver implements the Driver interface. NodeDriver is mainly used to control the overall procedure of peerly application. 1. Initialize all resources in the Initialize function. 2. Some long-running routines:
- Renew credential goroutine will keep the credential up to date.
- Read tunnel device data goroutine will read the data from tunnel device.
- Write tunnel device data goroutine will write the data to the tunnel device.
3. Filter out data via filter.
func (*NodeDriver) Drive ¶
func (d *NodeDriver) Drive(ctx context.Context)
Drive implement the Driver interface and will start all background threads to drive the application followup process.
func (*NodeDriver) FindServerIDWithPeerID ¶
func (d *NodeDriver) FindServerIDWithPeerID(res *protocol.PeerGraphResponse) protocol.ServerID
func (*NodeDriver) OnForward ¶
func (d *NodeDriver) OnForward(_ *relay.Client, typ message.PacketType, msg proto.Message) error
func (*NodeDriver) OnFragment ¶
func (d *NodeDriver) OnFragment(data []byte)
OnFragment implements the mesh.PacketCallback
func (*NodeDriver) OnProbeResponse ¶
func (d *NodeDriver) OnProbeResponse(_ *relay.Client, _ message.PacketType, msg proto.Message) error
func (*NodeDriver) OnSyncPeer ¶
func (d *NodeDriver) OnSyncPeer(_ *relay.Client, _ message.PacketType, msg proto.Message) error
func (*NodeDriver) Preflight ¶
func (d *NodeDriver) Preflight() error
func (*NodeDriver) SetPeerID ¶
func (d *NodeDriver) SetPeerID(id protocol.PeerID)
func (*NodeDriver) Summarize ¶
func (d *NodeDriver) Summarize() *Summary
Summarize implements the Driver interface.
func (*NodeDriver) Terminate ¶
func (d *NodeDriver) Terminate()
Terminate implements the Driver interface
type Profile ¶
type Summary ¶
type SummaryChangedCallback ¶
type SummaryChangedCallback func()
Click to show internal directories.
Click to hide internal directories.