relay

package
v0.2.34 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(Conn net.Conn, Channel string) (net.Conn, error)

func ExtractRemoteConn

func ExtractRemoteConn(RelayConn net.Conn) (string, error)

func NewListener

func NewListener(Dialer func() (net.Conn, error), Channel string, config *RelayListenerConfig) (net.Listener, *url.URL, error)

func UseRelayProtocol

func UseRelayProtocol(TransportScheme string, Dialer *client.Dialer) client.Protocol

Types

type Config

type Config struct {
	TracerFunc                util.TracerFunc
	BaseURL                   *url.URL
	BackgroundCleanupInterval time.Duration

	RelayDialTimeout  time.Duration
	EvictExistingPeer bool
}

type GetRemoteConnAddr

type GetRemoteConnAddr interface {
	GetRemoteAddr() string
}

type RelayListenerConfig

type RelayListenerConfig struct {
	RelayDialer      func() (net.Conn, error)
	HandshakeTimeout time.Duration

	TracerFunc util.TracerFunc
}

type Request

type Request struct {
	Type    string
	Payload string
}

type Response

type Response struct {
	Payload string
	Success bool
}

type Server

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

func New

func New(config *Config) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve(lis net.Listener) error

func (*Server) ServeConnection

func (s *Server) ServeConnection(conn net.Conn)

Jump to

Keyboard shortcuts

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