http

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Stage *stage

Functions

func ClientInitialize

func ClientInitialize()

func HandleResponse

func HandleResponse(session *clientpb.Session, resp *transport.GenericHTTPResponse)

func Initialize

func Initialize()

func ShortID

func ShortID(uuid string) string

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	ID int
}

type HTTPSession

type HTTPSession struct {
	ID            int
	RequestQueue  types.Queue
	ResponseQueue types.Queue
	Agent         *db.Agent
	LastActive    time.Time
	Status        SessionStatus

	Authenticated bool
	Killer        chan struct{}
	Info          transport.Registration
	SentRequests  map[string]int
	UsedBy        string
	// contains filtered or unexported fields
}

type Handler

type Handler struct {
	CertFile string
	KeyFile  string
	// contains filtered or unexported fields
}
var (
	MainHandler *Handler
	TranLogger  log.Logger
)

func NewHandler

func NewHandler() *Handler

func (*Handler) AwaitResponse

func (h *Handler) AwaitResponse(sessionID int) *transport.GenericHTTPResponse

func (*Handler) IsActive

func (h *Handler) IsActive() bool

func (*Handler) IsActiveTLS

func (h *Handler) IsActiveTLS() bool

func (*Handler) NewSession

func (h *Handler) NewSession(agent *db.Agent, isTCP bool, connectInfo *transport.Registration) (string, time.Time, int, error)

func (*Handler) QueueRequest

func (h *Handler) QueueRequest(sessionID int, req *transport.GenericHTTPRequest) error

func (*Handler) RmSession

func (h *Handler) RmSession(sessID int)

RmSession removes a session in special cases, such as if it dies unexpectedly

func (*Handler) Serve

func (h *Handler) Serve()

func (*Handler) ServeTLS

func (h *Handler) ServeTLS()

func (*Handler) SessionByID

func (h *Handler) SessionByID(sessID int) *HTTPSession

SessionByID retrieves an active HTTP connection with an agent, if said agent has ever had an active session

func (*Handler) Sessions

func (h *Handler) Sessions(sessIDs []int) []*HTTPSession

func (*Handler) Stop

func (h *Handler) Stop() error

func (*Handler) StopTLS

func (h *Handler) StopTLS() error

type RequestQueue

type RequestQueue struct {
	// expose for TCP
	Channel chan *transport.GenericHTTPRequest
}

RequestQueue holds up to queueCapacity responses for a callback. If full, an error is raised.

func NewRequestQueue

func NewRequestQueue() *RequestQueue

func (*RequestQueue) Dequeue

func (r *RequestQueue) Dequeue() interface{}

func (*RequestQueue) Enqueue

func (r *RequestQueue) Enqueue(req interface{}) error

func (*RequestQueue) Size

func (r *RequestQueue) Size() int

type ResponseQueue

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

func NewResponseQueue

func NewResponseQueue() *ResponseQueue

func (*ResponseQueue) Dequeue

func (r *ResponseQueue) Dequeue() interface{}

func (*ResponseQueue) Enqueue

func (r *ResponseQueue) Enqueue(req interface{}) error

func (*ResponseQueue) Size

func (r *ResponseQueue) Size() int

type SessionStatus

type SessionStatus string
const (
	StatusActive   SessionStatus = "active"
	StatusInactive SessionStatus = "inactive"
	StatusKilled   SessionStatus = "killed"
)

type StageItem

type StageItem struct {
	Path     string
	Agent    string
	StagedBy string
}

Jump to

Keyboard shortcuts

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