trace

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPInfo added in v0.0.7

type IPInfo struct {
	Status     string `json:"status"`
	Country    string `json:"country"`
	RegionName string `json:"regionName"`
	City       string `json:"city"`
	ISP        string `json:"isp"`
	Query      string `json:"query"`
}

IPInfo represents the response from IP-API

type Message

type Message struct {
	Type    MessageType    // Message type: trace, error, close, finish
	Time    time.Time      // Time when the message was created
	Content string         // The actual message content
	Headers RequestHeaders // Original request headers (if applicable)
	Error   error          // Error information (if applicable)
}

Message represents a structured message in the system

type MessageType added in v0.0.7

type MessageType int
const (
	MessageTypeTrace MessageType = iota
	MessageTypeError
	MessageTypeCheckEnd
	MessageTypeClose
	MessageTypeAPI
)

type RecordManager

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

RecordManager handles trace records and messages

func New

func New() *RecordManager

New creates a new record manager

func (*RecordManager) AddApiResponse added in v0.0.7

func (r *RecordManager) AddApiResponse(content string)

func (*RecordManager) AddCheckEndMessage added in v0.0.7

func (r *RecordManager) AddCheckEndMessage()

func (*RecordManager) AddCloseMessage added in v0.0.7

func (r *RecordManager) AddCloseMessage()

func (*RecordManager) AddErrorMessage

func (r *RecordManager) AddErrorMessage(err error)

AddErrorMessage adds an error message to the record

func (*RecordManager) AddMessage

func (r *RecordManager) AddMessage(content string)

AddMessage adds a new message to the record

func (*RecordManager) Done

func (r *RecordManager) Done() <-chan struct{}

Done returns the done channel

func (*RecordManager) ProcessRequest

func (r *RecordManager) ProcessRequest(headers RequestHeaders)

ProcessRequest processes the request headers and adds trace messages

func (*RecordManager) Shutdown added in v0.0.7

func (r *RecordManager) Shutdown()

Shutdown cleanly shuts down the record manager

func (*RecordManager) Start

func (r *RecordManager) Start(ctx context.Context)

Start begins processing trace events

type RequestHeaders

type RequestHeaders struct {
	UserAgent    string    `json:"user_agent"`
	ForwardedFor string    `json:"forwarded_for"`
	ConnectingIP string    `json:"connecting_ip"`
	Country      string    `json:"country"`
	Time         time.Time `json:"time"`
	IP           string    `json:"ip"`
	Location     string    `json:"location"`
	ISP          string    `json:"isp"`
}

RequestHeaders contains information about the request

type RequestSignature

type RequestSignature struct {
	UserAgent    string
	ForwardedFor string
	ConnectingIP string
	IP           string
}

RequestSignature represents a unique signature for a request

type TraceInfo

type TraceInfo struct {
	TimeStr      string
	UserAgent    string
	ForwardedFor string
	ConnectingIP string
	IP           string
	NodeNum      int
	Location     string
	ISP          string
}

TraceInfo represents processed trace information

func (*TraceInfo) FormatMessages

func (t *TraceInfo) FormatMessages() string

FormatMessages formats the trace info into platform and IP path messages

Jump to

Keyboard shortcuts

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