transaction

package
v0.0.0-...-f3c9c56 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_TRANSACTIONS_LEN int = 8 * 1024

Variables

View Source
var AddChannel chan *Tx = make(chan *Tx)

Functions

func CopyHeader

func CopyHeader(h http.Header) http.Header

func NewSingleHostReverseProxy

func NewSingleHostReverseProxy(target *url.URL) *httputil.ReverseProxy

func Serve

func Serve()

Types

type Hub

type Hub struct {
	Transactions map[uuid.UUID]*Tx
	SortID       []uuid.UUID
	DB           *bolt.DB
}
var TxHub *Hub

func NewTxHub

func NewTxHub() *Hub

func (*Hub) Add

func (h *Hub) Add(t Tx) error

func (*Hub) List

func (h *Hub) List() []*Tx

type Req

type Req struct {
	URL    *url.URL    `json:"URL"`
	Method string      `json:"Method"`
	Proto  string      `json:"Proto"`
	Header http.Header `json:"Header"`
	Body   []byte      `json:"Body"`
}

func NewReq

func NewReq(req *http.Request) *Req

type Resp

type Resp struct {
	Proto  string
	Header http.Header `json:"Header"`
	Body   []byte      `json:"Body"`
	Status string      `json:"Status"`
}

func NewResp

func NewResp(resp *http.Response) *Resp

type Transport

type Transport struct {
	http.RoundTripper
}

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

type Tx

type Tx struct {
	ID         uuid.UUID `json:"ID"`
	Req        *Req      `json:"Req"`
	Resp       *Resp     `json:"Resp"`
	ClientAddr string    `json:"ClientAddr"`
	BeginAt    time.Time `json:"BeginAt"`
	EndAt      time.Time `json:"EndAt"`
}

Jump to

Keyboard shortcuts

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