client

package
v0.0.0-...-c5ad9ab Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2017 License: BSD-3-Clause Imports: 40 Imported by: 1

Documentation

Overview

Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCredentialExpired = errors.New("Certificate has expired.")
)

Functions

func CachePath

func CachePath() (string, error)

func FingerprintString

func FingerprintString(f []byte) string

func GenerateNewCA

func GenerateNewCA(capath string) (tls.Certificate, error)

func KeytalkPath

func KeytalkPath() (string, error)

func LoadCA

func LoadCA(capath string) (tls.Certificate, error)

Types

type CertPool

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

CertPool is a set of certificates.

func NewCertPool

func NewCertPool() *CertPool

NewCertPool returns a new, empty CertPool.

func (*CertPool) AddCert

func (s *CertPool) AddCert(cert *x509.Certificate)

AddCert adds a certificate to a pool.

func (*CertPool) AppendCertsFromPEM

func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool)

AppendCertsFromPEM attempts to parse a series of PEM encoded certificates. It appends any certificates found to s and reports whether any certificates were successfully parsed.

On many Linux systems, /etc/ssl/cert.pem will contain the system wide set of root CAs in a format suitable for this function.

func (*CertPool) Certs

func (s *CertPool) Certs() []*x509.Certificate

func (*CertPool) Subjects

func (s *CertPool) Subjects() [][]byte

Subjects returns a list of the DER-encoded subjects of all of the certificates in the pool.

type Client

type Client struct {
	Preferences Preferences
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Client, error)

func (*Client) ListenAndServe

func (client *Client) ListenAndServe()

func (*Client) TLSConfigFromCA

func (client *Client) TLSConfigFromCA(host string, ctx *goproxy.ProxyCtx) (*tls.Config, error)

type Config

type Config struct {
	ListenerString string `toml:"listen"`

	Username string `toml:"username"`
	Password string `toml:"password"`
	Service  string `toml:"service"`

	Logging []struct {
		Output string `toml:"output"`
		Level  string `toml:"level"`
	} `toml:"logging"`
}

type Credential

type Credential struct {
	Certificate *openssl.Certificate
	PrivateKey  openssl.PrivateKey

	NotBefore time.Time
	NotAfter  time.Time

	ServiceURIs []string
}

func (*Credential) Valid

func (credential *Credential) Valid() error

type Hub

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

hub maintains the set of active clients and broadcasts messages to the clients.

func (*Hub) Broadcast

func (h *Hub) Broadcast(msg interface{}) error

type Preferences

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

func (Preferences) Get

func (p Preferences) Get(key string) (interface{}, bool)

func (Preferences) Load

func (p Preferences) Load()

func (Preferences) Set

func (p Preferences) Set(key string, val interface{})

func (Preferences) Sync

func (p Preferences) Sync()

type ReverseProxy

type ReverseProxy struct {
	// Director must be a function which modifies
	// the request into a new request to be sent
	// using Transport. Its response is then copied
	// back to the original client unmodified.
	Director func(*http.Request)

	// The transport used to perform proxy requests.
	// If nil, http.DefaultTransport is used.
	Transport http.RoundTripper

	// FlushInterval specifies the flush interval
	// to flush to the client while copying the
	// response body.
	// If zero, no periodic flushing is done.
	FlushInterval time.Duration
}

ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy() *ReverseProxy

NewSingleHostReverseProxy returns a new ReverseProxy that rewrites URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir.

func (*ReverseProxy) ServeHTTP

func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

type RoundTripper

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

func (*RoundTripper) RoundTrip

func (rt *RoundTripper) RoundTrip(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Response, error)

type RoundTripper2

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

func (*RoundTripper2) RoundTrip

func (rt *RoundTripper2) RoundTrip(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Response, error)

Jump to

Keyboard shortcuts

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