relay

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package relay implements all the SNI relay logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// ListenAddr is the address the SNI relay server will listen to.
	ListenAddr netip.Addr

	// ListenPort is the port the SNI relay expects to receive plain HTTP
	// requests to.
	ListenPort uint16

	// ListenPortTLS is the port the SNI relay expects to receive HTTPS requests
	// to.
	ListenPortTLS uint16

	// ProxyURL is the proxy server address (optional).
	ProxyURL *url.URL

	// RedirectDomains is a list of wildcards the relay server can reroute.
	// If the incoming connection is not from this list, the connection will
	// not be accepted.
	RedirectDomains []string
}

Config represents the SNI relay server configuration.

type Server

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

Server implements all the relay logic, listens for incoming connections and redirects them to the proper server.

func NewServer

func NewServer(cfg *Config) (s *Server, err error)

NewServer creates a new instance of *Server.

func (*Server) AddrPlain

func (s *Server) AddrPlain() (addr net.Addr)

AddrPlain returns the address where the server listens for plain traffic.

func (*Server) AddrTLS

func (s *Server) AddrTLS() (addr net.Addr)

AddrTLS returns the address where the server listens for TLS traffic.

func (*Server) Close

func (s *Server) Close() (err error)

Close implements the io.Closer interface for *Server.

func (*Server) Start

func (s *Server) Start() (err error)

Start starts the relay server.

Jump to

Keyboard shortcuts

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