protocol

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P2PHttpID   protocol.ID = "/http"
	ID          protocol.ID = "/p2pdao/libp2p-proxy/1.0.0"
	ServiceName string      = "p2pdao.libp2p-proxy"
)

Variables

View Source
var Log = logging.Logger("libp2p-proxy")

Functions

func IsSocks5

func IsSocks5(v byte) bool

Types

type ACLFilter

type ACLFilter struct {
	// contains filtered or unexported fields
}

func NewACL

func NewACL(cfg config.ACLConfig) (*ACLFilter, error)

func (*ACLFilter) Allow

func (a *ACLFilter) Allow(p peer.ID, addr ma.Multiaddr) bool

func (*ACLFilter) InterceptAccept added in v1.2.0

func (a *ACLFilter) InterceptAccept(cm network.ConnMultiaddrs) (allow bool)

func (*ACLFilter) InterceptAddrDial added in v1.2.0

func (a *ACLFilter) InterceptAddrDial(peer.ID, ma.Multiaddr) (allow bool)

func (*ACLFilter) InterceptPeerDial added in v1.2.0

func (a *ACLFilter) InterceptPeerDial(p peer.ID) (allow bool)

func (*ACLFilter) InterceptSecured added in v1.2.0

func (a *ACLFilter) InterceptSecured(di network.Direction, p peer.ID, cm network.ConnMultiaddrs) (allow bool)

func (*ACLFilter) InterceptUpgraded added in v1.2.0

func (a *ACLFilter) InterceptUpgraded(network.Conn) (allow bool, reason control.DisconnectReason)

type BufReaderStream

type BufReaderStream struct {
	Reader *bufio.Reader
	// contains filtered or unexported fields
}

func NewBufReaderStream

func NewBufReaderStream(s Stream) *BufReaderStream

func (*BufReaderStream) Close added in v1.1.0

func (bs *BufReaderStream) Close() error

func (*BufReaderStream) CloseRead added in v1.1.0

func (bs *BufReaderStream) CloseRead() error

func (*BufReaderStream) CloseWrite added in v1.1.0

func (bs *BufReaderStream) CloseWrite() error

func (*BufReaderStream) Read

func (bs *BufReaderStream) Read(p []byte) (int, error)

func (*BufReaderStream) Reset added in v1.1.0

func (bs *BufReaderStream) Reset() error

func (*BufReaderStream) SetDeadline added in v1.1.0

func (bs *BufReaderStream) SetDeadline(t time.Time) error

func (*BufReaderStream) SetReadDeadline added in v1.1.0

func (bs *BufReaderStream) SetReadDeadline(t time.Time) error

func (*BufReaderStream) SetWriteDeadline added in v1.1.0

func (bs *BufReaderStream) SetWriteDeadline(t time.Time) error

func (*BufReaderStream) Write added in v1.1.0

func (bs *BufReaderStream) Write(p []byte) (n int, err error)

type ProxyService

type ProxyService struct {
	// contains filtered or unexported fields
}

func NewProxyService

func NewProxyService(ctx context.Context, h host.Host, p2pHost string) *ProxyService

func (*ProxyService) Close added in v1.1.0

func (p *ProxyService) Close() error

Close terminates this listener. It will no longer handle any incoming streams

func (*ProxyService) Handler

func (p *ProxyService) Handler(s network.Stream)

func (*ProxyService) Serve

func (p *ProxyService) Serve(proxyAddr string, remotePeer peer.ID) error

func (*ProxyService) ServeHTTP added in v1.1.0

func (p *ProxyService) ServeHTTP(handler http.Handler, s *http.Server) error

func (*ProxyService) Wait

func (p *ProxyService) Wait(fn func() error) error

type Stream added in v1.2.0

type Stream interface {
	Read(b []byte) (n int, err error)
	Write(b []byte) (n int, err error)
	Close() error

	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

Jump to

Keyboard shortcuts

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