proxy

package
v0.4.11-pre Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2017 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ProtocolSNR = "/ipfs/supernoderouting"

Variables

This section is empty.

Functions

This section is empty.

Types

type Loopback

type Loopback struct {
	Handler RequestHandler
	Local   peer.ID
}

Loopback forwards requests to a local handler

func (*Loopback) Bootstrap

func (_ *Loopback) Bootstrap(ctx context.Context) error

func (*Loopback) HandleStream

func (lb *Loopback) HandleStream(s inet.Stream)

func (*Loopback) SendMessage

func (lb *Loopback) SendMessage(ctx context.Context, m *dhtpb.Message) error

SendMessage intercepts local requests, forwarding them to a local handler

func (*Loopback) SendRequest

func (lb *Loopback) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.Message, error)

SendRequest intercepts local requests, forwarding them to a local handler

type Proxy

type Proxy interface {
	Bootstrap(context.Context) error
	HandleStream(inet.Stream)
	SendMessage(ctx context.Context, m *dhtpb.Message) error
	SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.Message, error)
}

func Standard

func Standard(h host.Host, remotes []pstore.PeerInfo) Proxy

type RequestHandler

type RequestHandler interface {
	HandleRequest(ctx context.Context, p peer.ID, m *dhtpb.Message) *dhtpb.Message
}

RequestHandler handles routing requests locally

Jump to

Keyboard shortcuts

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