introducer

package
v0.0.0-...-5012d17 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

introducer is a simple obfuscated proxy that points to an instance of the menshen API. The upstream API can be publicly available or not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClientFromIntroducer

func NewHTTPClientFromIntroducer(introducer *Introducer) (*http.Client, error)

NewHTTPClientFromIntroducer returns an http.Client that will use the passed introducer.

Types

type CallbackTransport

type CallbackTransport struct {
	OriginalTransport http.RoundTripper
	Callback          func(*http.Response)
}

CallbackTransport calls a callback function after a successful 200 OK response.

func (*CallbackTransport) RoundTrip

func (c *CallbackTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip performs the request and calls the callback if we get a 200 OK.

type Introducer

type Introducer struct {
	Type string
	Addr string
	Cert string
	FQDN string
	KCP  bool
}

Introducer has everything we need to instantiate a http.Client that dials to the obfuscated introducer.

func NewIntroducerFromURL

func NewIntroducerFromURL(introducerURL string) (*Introducer, error)

NewIntroducerFromURL returns a new Introducer after parsing the passed URL. It will also return an error if it was not possible to parse the URL correctly.

func (*Introducer) URL

func (i *Introducer) URL() string

URL produces the canonical URL for this introducer. We need to make sure to use this URL in the internal storage, so that we can ensure equality regardless of parameter order.

func (*Introducer) Validate

func (i *Introducer) Validate() error

Validate returns true if all the fields in this Introducer are like expected.

Jump to

Keyboard shortcuts

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