proxy

package
v0.4.9-rc2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2017 License: MIT Imports: 11 Imported by: 0

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