kish

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRemoteIP

func GetRemoteIP(req *http.Request, trustXFF bool) string

func GetWsURL

func GetWsURL(req *http.Request) *url.URL

func IsWebsocket

func IsWebsocket(req *http.Request) bool

func LogRequest

func LogRequest(prefix string, r *http.Request, full bool)

func LogResponse

func LogResponse(prefix string, r *http.Response, full bool)

func MakeProxyJWT

func MakeProxyJWT(params *ProxyParameters, key []byte, keyID string) (string, error)

func MakeRWC

func MakeRWC(conn *websocket.Conn) io.ReadWriteCloser

func Passthrough

func Passthrough(a, b io.ReadWriter) error

func PassthroughWebsocket

func PassthroughWebsocket(dialer *websocket.Dialer, w http.ResponseWriter, req *http.Request) (*http.Response, error)

func ReadAllAndClose

func ReadAllAndClose(rc io.ReadCloser) []byte

Types

type BuildFunc

type BuildFunc func(*mux.Router)

type HTTPRequestMiddleware

type HTTPRequestMiddleware func(*http.Request) *http.Response

type HTTPRequestModifyFunc

type HTTPRequestModifyFunc func(*http.Request) error

type HTTPRequestReader

type HTTPRequestReader struct {
	Conn        io.ReadWriteCloser
	ConnBufR    *bufio.Reader
	BufferedReq *http.Request
}

type HTTPResponseMiddleware

type HTTPResponseMiddleware func(*http.Response)

type HasKeyID

type HasKeyID interface {
	GetKeyID() string
}

type IPSet

type IPSet struct {
	Nets []net.IPNet
}

func (*IPSet) Add

func (is *IPSet) Add(s string) error

func (*IPSet) Contains

func (is *IPSet) Contains(ip net.IP) bool

func (*IPSet) ContainsHostPort

func (is *IPSet) ContainsHostPort(s string) (bool, string, string)

func (*IPSet) ContainsIPString

func (is *IPSet) ContainsIPString(s string) bool

func (*IPSet) String

func (is *IPSet) String() string

type KishServer

type KishServer struct {
	Host              string
	ProxyDomainSuffix string

	TokenSet            *TokenSet
	TrustXFF            bool
	EnableTCPForwarding bool
	WebsocketHandler    string
	// contains filtered or unexported fields
}

func (*KishServer) AddHostRouter

func (rs *KishServer) AddHostRouter(host string, buildFunc BuildFunc) error

func (*KishServer) DeleteHostRouter

func (rs *KishServer) DeleteHostRouter(host string)

func (*KishServer) Init

func (rs *KishServer) Init()

func (*KishServer) ServeHTTP

func (rs *KishServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProxyClaims

type ProxyClaims struct {
	KeyID string `json:"keyID"`
	ProxyParameters
	jwt.RegisteredClaims
}

func (*ProxyClaims) GetKeyID

func (c *ProxyClaims) GetKeyID() string

type ProxyParameters

type ProxyParameters struct {
	Host      string            `json:"host"`
	AllowIP   []string          `json:"allowIP"`
	BasicAuth map[string]string `json:"basicAuth"`
	AllowMyIP bool              `json:"allowMyIP"`
}

type TokenSet

type TokenSet struct {
	Path    string
	ModTime time.Time
	Tokens  *map[string]string
}

func (*TokenSet) Get

func (ts *TokenSet) Get(keyID string) []byte

Directories

Path Synopsis
cmd
kish command
kish-server command

Jump to

Keyboard shortcuts

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