Documentation ¶
Index ¶
- Constants
- Variables
- type Options
- type Path
- type PendCallResItem
- type PendingCallResArray
- type RelayStream
- type RouteTab
- type Service
- func (s *Service) Close() error
- func (s *Service) Connect(ctx context.Context, target boson.Address) error
- func (s *Service) DelRoute(_ context.Context, target boson.Address) error
- func (s *Service) FindRoute(ctx context.Context, target boson.Address, timeouts ...time.Duration) (paths []*Path, err error)
- func (s *Service) FindUnderlay(ctx context.Context, target boson.Address, timeouts ...time.Duration) (addr *aurora.Address, err error)
- func (s *Service) GetNextHopRandomOrFind(ctx context.Context, target boson.Address, skips ...boson.Address) (next boson.Address, err error)
- func (s *Service) GetRoute(_ context.Context, dest boson.Address) ([]*Path, error)
- func (s *Service) GetTargetNeighbor(ctx context.Context, target boson.Address, limit int) (addresses []boson.Address, err error)
- func (s *Service) IsNeighbor(dest boson.Address) (has bool)
- func (s *Service) Metrics() []prometheus.Collector
- func (s *Service) PackRelayReq(ctx context.Context, stream p2p.VirtualStream, req *pb.RouteRelayReq)
- func (s *Service) PackRelayResp(ctx context.Context, stream p2p.VirtualStream, reqCh chan *pb.RouteRelayReq)
- func (s *Service) Protocol() p2p.ProtocolSpec
- type Table
- func (t *Table) Delete(path *Path)
- func (t *Table) Gc(expire time.Duration)
- func (t *Table) Get(target boson.Address) ([]*Path, error)
- func (t *Table) GetNextHop(target boson.Address, skips ...boson.Address) (next []boson.Address)
- func (t *Table) IterateTarget(items []boson.Address, fn func(target boson.Address))
- func (t *Table) ResumePaths()
- func (t *Table) ResumeRoutes()
- func (t *Table) SavePath(p *pb.Path)
- func (t *Table) SavePaths(paths []*pb.Path)
- type TargetRoute
Constants ¶
View Source
const ( ProtocolName = "router" ProtocolVersion = "3.0.0" StreamOnRelay = "relay" StreamOnRelayConnChain = "relayConnChain" )
Variables ¶
View Source
var ( MaxTTL int32 = 10 NeighborAlpha int32 = 2 )
View Source
var (
ErrNotFound = errors.New("route: not found")
)
View Source
var (
PendingTimeout = time.Second * 5
)
Functions ¶
This section is empty.
Types ¶
type PendCallResItem ¶ added in v1.0.9
type PendingCallResArray ¶ added in v1.0.9
type PendingCallResArray []*PendCallResItem
type RelayStream ¶ added in v1.2.0
type RelayStream interface { GetNextHopRandomOrFind(ctx context.Context, target boson.Address, skips ...boson.Address) (next boson.Address, err error) PackRelayReq(ctx context.Context, stream p2p.VirtualStream, req *pb.RouteRelayReq) PackRelayResp(ctx context.Context, stream p2p.VirtualStream, req chan *pb.RouteRelayReq) }
type RouteTab ¶
type RouteTab interface { GetRoute(ctx context.Context, dest boson.Address) (paths []*Path, err error) FindRoute(ctx context.Context, dest boson.Address, timeout ...time.Duration) (paths []*Path, err error) DelRoute(ctx context.Context, dest boson.Address) (err error) Connect(ctx context.Context, dest boson.Address) error GetTargetNeighbor(ctx context.Context, dest boson.Address, limit int) (addresses []boson.Address, err error) IsNeighbor(dest boson.Address) (has bool) FindUnderlay(ctx context.Context, target boson.Address, timeouts ...time.Duration) (addr *aurora.Address, err error) }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) FindUnderlay ¶ added in v1.2.0
func (*Service) GetNextHopRandomOrFind ¶ added in v1.2.0
func (*Service) GetTargetNeighbor ¶
func (*Service) Metrics ¶
func (s *Service) Metrics() []prometheus.Collector
func (*Service) PackRelayReq ¶ added in v1.2.0
func (s *Service) PackRelayReq(ctx context.Context, stream p2p.VirtualStream, req *pb.RouteRelayReq)
PackRelayReq This packet mode is UDP mode and writing success does not mean that the final target has received a message
func (*Service) PackRelayResp ¶ added in v1.2.0
func (s *Service) PackRelayResp(ctx context.Context, stream p2p.VirtualStream, reqCh chan *pb.RouteRelayReq)
PackRelayResp This packet mode is UDP mode and writing success does not mean that the final target has received a message This channel is closed by the initiator node
func (*Service) Protocol ¶
func (s *Service) Protocol() p2p.ProtocolSpec
type Table ¶ added in v1.0.9
type Table struct {
// contains filtered or unexported fields
}
func (*Table) GetNextHop ¶ added in v1.0.9
func (*Table) IterateTarget ¶ added in v1.2.0
func (*Table) ResumePaths ¶ added in v1.2.0
func (t *Table) ResumePaths()
func (*Table) ResumeRoutes ¶ added in v1.2.0
func (t *Table) ResumeRoutes()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.