traffic

package
v0.0.0-...-fddd243 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CaptureMode_name = map[int32]string{
		0: "CAPTURE_MODE_UNSPECIFIED",
		1: "CAPTURE_MODE_RELAY",
		2: "CAPTURE_MODE_RECORD",
	}
	CaptureMode_value = map[string]int32{
		"CAPTURE_MODE_UNSPECIFIED": 0,
		"CAPTURE_MODE_RELAY":       1,
		"CAPTURE_MODE_RECORD":      2,
	}
)

Enum value maps for CaptureMode.

View Source
var (
	RoutingMode_name = map[int32]string{
		0: "ROUTING_MODE_UNSPECIFIED",
		1: "ROUTING_MODE_DIRECT",
		2: "ROUTING_MODE_PROXY",
		3: "ROUTING_MODE_SUBSCRIBE",
		4: "ROUTING_MODE_AUTO",
		5: "ROUTING_MODE_SWITCH",
		6: "ROUTING_MODE_CLEAR",
	}
	RoutingMode_value = map[string]int32{
		"ROUTING_MODE_UNSPECIFIED": 0,
		"ROUTING_MODE_DIRECT":      1,
		"ROUTING_MODE_PROXY":       2,
		"ROUTING_MODE_SUBSCRIBE":   3,
		"ROUTING_MODE_AUTO":        4,
		"ROUTING_MODE_SWITCH":      5,
		"ROUTING_MODE_CLEAR":       6,
	}
)

Enum value maps for RoutingMode.

View Source
var File_aop_traffic_protocol_proto protoreflect.FileDescriptor

Functions

func ReadBody

func ReadBody(ref *BodyRef) ([]byte, error)

ReadBody loads a body reference on demand. It intentionally does not cache the bytes in the reference so callers control the resulting allocation.

Types

type BodyRef

type BodyRef struct {
	Path      string `json:"path,omitempty"`
	Size      int64  `json:"size"`
	SHA256    string `json:"sha256,omitempty"`
	Complete  bool   `json:"complete"`
	Truncated bool   `json:"truncated,omitempty"`
}

BodyRef describes a body kept outside the hot Exchange value. Body contains only the configured preview; callers that need the complete payload can hydrate it from Path.

type BodySink

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

BodySink writes a body to a temporary file while retaining a small preview. It is safe for a single reader goroutine and Close is idempotent.

func NewBodySink

func NewBodySink(dir, name string, previewMax int) (*BodySink, error)

NewBodySink creates <name>.part in dir and atomically publishes it as name when Close(true) succeeds. The directory is created when needed.

func (*BodySink) Close

func (s *BodySink) Close(complete bool) (BodyRef, error)

Close finishes the body. A failed or incomplete capture keeps its .part file for diagnosis and reports Complete=false in the returned reference.

func (*BodySink) Discard

func (s *BodySink) Discard() error

Discard closes and removes a capture that was filtered out before it became a visible Exchange.

func (*BodySink) Preview

func (s *BodySink) Preview() []byte

Preview returns a copy of the bytes retained for list/detail summaries.

func (*BodySink) Reader

func (s *BodySink) Reader(r io.Reader) io.Reader

Reader wraps r so body bytes are captured as they pass through the proxy.

func (*BodySink) Write

func (s *BodySink) Write(p []byte) (int, error)

Write appends p to the body file and updates its preview and digest.

type CaptureConfig

type CaptureConfig struct {
	Mode         CaptureMode `protobuf:"varint,1,opt,name=mode,proto3,enum=aop.traffic.CaptureMode" json:"mode,omitempty"`
	DecryptHttps bool        `protobuf:"varint,2,opt,name=decrypt_https,json=decryptHttps,proto3" json:"decrypt_https,omitempty"` // intercept CONNECT to MITM-decrypt HTTPS
	Filter       *FlowFilter `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"`                                  // record only matching flows
	Stream       bool        `protobuf:"varint,4,opt,name=stream,proto3" json:"stream,omitempty"`                                 // push Flow messages as they are captured
	// contains filtered or unexported fields
}

CaptureConfig sets the hub's capture behaviour. It flips the runtime record flag; the listener address never changes so in-flight children are unaffected.

func (*CaptureConfig) Descriptor deprecated

func (*CaptureConfig) Descriptor() ([]byte, []int)

Deprecated: Use CaptureConfig.ProtoReflect.Descriptor instead.

func (*CaptureConfig) GetDecryptHttps

func (x *CaptureConfig) GetDecryptHttps() bool

func (*CaptureConfig) GetFilter

func (x *CaptureConfig) GetFilter() *FlowFilter

func (*CaptureConfig) GetMode

func (x *CaptureConfig) GetMode() CaptureMode

func (*CaptureConfig) GetStream

func (x *CaptureConfig) GetStream() bool

func (*CaptureConfig) ProtoMessage

func (*CaptureConfig) ProtoMessage()

func (*CaptureConfig) ProtoReflect

func (x *CaptureConfig) ProtoReflect() protoreflect.Message

func (*CaptureConfig) Reset

func (x *CaptureConfig) Reset()

func (*CaptureConfig) String

func (x *CaptureConfig) String() string

type CaptureMode

type CaptureMode int32

CaptureMode selects what the hub does with traffic it routes. RELAY forwards undecrypted and records nothing; RECORD intercepts (MITM) and stores flows.

const (
	CaptureMode_CAPTURE_MODE_UNSPECIFIED CaptureMode = 0 // leave capture unchanged (Configure)
	CaptureMode_CAPTURE_MODE_RELAY       CaptureMode = 1 // route only: no interception, no record
	CaptureMode_CAPTURE_MODE_RECORD      CaptureMode = 2 // intercept + record
)

func (CaptureMode) Descriptor

func (CaptureMode) Enum

func (x CaptureMode) Enum() *CaptureMode

func (CaptureMode) EnumDescriptor deprecated

func (CaptureMode) EnumDescriptor() ([]byte, []int)

Deprecated: Use CaptureMode.Descriptor instead.

func (CaptureMode) Number

func (x CaptureMode) Number() protoreflect.EnumNumber

func (CaptureMode) String

func (x CaptureMode) String() string

func (CaptureMode) Type

type CaptureState

type CaptureState struct {
	Mode      CaptureMode `protobuf:"varint,1,opt,name=mode,proto3,enum=aop.traffic.CaptureMode" json:"mode,omitempty"`
	Capturing bool        `protobuf:"varint,2,opt,name=capturing,proto3" json:"capturing,omitempty"`
	// contains filtered or unexported fields
}

func (*CaptureState) Descriptor deprecated

func (*CaptureState) Descriptor() ([]byte, []int)

Deprecated: Use CaptureState.ProtoReflect.Descriptor instead.

func (*CaptureState) GetCapturing

func (x *CaptureState) GetCapturing() bool

func (*CaptureState) GetMode

func (x *CaptureState) GetMode() CaptureMode

func (*CaptureState) ProtoMessage

func (*CaptureState) ProtoMessage()

func (*CaptureState) ProtoReflect

func (x *CaptureState) ProtoReflect() protoreflect.Message

func (*CaptureState) Reset

func (x *CaptureState) Reset()

func (*CaptureState) String

func (x *CaptureState) String() string

type Configure

type Configure struct {
	Routing *RoutingConfig `protobuf:"bytes,1,opt,name=routing,proto3" json:"routing,omitempty"`
	Capture *CaptureConfig `protobuf:"bytes,2,opt,name=capture,proto3" json:"capture,omitempty"`
	// contains filtered or unexported fields
}

Configure declares desired routing and/or capture state. An absent sub-message leaves that facet unchanged; the handler replies with the resulting State.

func (*Configure) Descriptor deprecated

func (*Configure) Descriptor() ([]byte, []int)

Deprecated: Use Configure.ProtoReflect.Descriptor instead.

func (*Configure) GetCapture

func (x *Configure) GetCapture() *CaptureConfig

func (*Configure) GetRouting

func (x *Configure) GetRouting() *RoutingConfig

func (*Configure) ProtoMessage

func (*Configure) ProtoMessage()

func (*Configure) ProtoReflect

func (x *Configure) ProtoReflect() protoreflect.Message

func (*Configure) Reset

func (x *Configure) Reset()

func (*Configure) String

func (x *Configure) String() string

type Exchange

type Exchange struct {
	ID       string
	Request  Request
	Response *Response
	Error    string
	Complete bool
}

Exchange is the canonical in-memory form of one captured HTTP exchange, composed of a request and an optional response. The Flow proto message is its wire view; the two are one model, converted by ExchangeFromFlow and Proto.

Its JSON form is the flow element of the http.exchange.v1 evidence payload, where headers serialize as a name→values map for compatibility with the stored contract. Order and duplicate names survive in memory; the map view is the persisted projection.

func ExchangeFromFlow

func ExchangeFromFlow(f *Flow) *Exchange

ExchangeFromFlow lifts a wire Flow into its canonical form. ToolId and Timestamp are attribution and transport metadata, not exchange semantics, so they do not cross over.

func ExchangeFromHTTP

func ExchangeFromHTTP(req *http.Request, resp *http.Response, requestBody, responseBody []byte) *Exchange

ExchangeFromHTTP converts the standard library's request/response pair into the canonical HTTP observation model. Callers provide body bytes explicitly because the http bodies are streaming and may already have been consumed by the caller (for example, by a file-backed recorder).

func (Exchange) Clone

func (e Exchange) Clone() Exchange

Clone returns an independent exchange value, including response metadata and body references. The proxy hot store uses it before hydrating a body so a query or subscriber never mutates the retained preview under a read lock.

func (*Exchange) HydrateBodies

func (e *Exchange) HydrateBodies() error

HydrateBodies loads file-backed request/response bodies into Body. It is intentionally explicit so list/query paths do not allocate large payloads.

func (Exchange) MarshalJSON

func (e Exchange) MarshalJSON() ([]byte, error)

func (*Exchange) Proto

func (e *Exchange) Proto() *Flow

Proto renders the exchange as a wire Flow. Attribution (ToolId, Timestamp) is the caller's to stamp.

func (*Exchange) UnmarshalJSON

func (e *Exchange) UnmarshalJSON(data []byte) error

type Flow

type Flow struct {
	Id        string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	ToolId    string                 `protobuf:"bytes,2,opt,name=tool_id,json=toolId,proto3" json:"tool_id,omitempty"`
	Error     string                 `protobuf:"bytes,12,opt,name=error,proto3" json:"error,omitempty"`
	Complete  bool                   `protobuf:"varint,13,opt,name=complete,proto3" json:"complete,omitempty"`
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Request   *HttpRequest           `protobuf:"bytes,15,opt,name=request,proto3" json:"request,omitempty"`
	Response  *HttpResponse          `protobuf:"bytes,16,opt,name=response,proto3" json:"response,omitempty"` // absent when no response was received
	// contains filtered or unexported fields
}

Flow is one captured request/response exchange. Its nested shape mirrors the consumer's http.exchange form so a consumer can map it directly; tool_id is the AOP tool-call id whose egress produced this flow. Fields 3-11 were the pre-nesting flat shape.

func (*Flow) Descriptor deprecated

func (*Flow) Descriptor() ([]byte, []int)

Deprecated: Use Flow.ProtoReflect.Descriptor instead.

func (*Flow) GetComplete

func (x *Flow) GetComplete() bool

func (*Flow) GetError

func (x *Flow) GetError() string

func (*Flow) GetId

func (x *Flow) GetId() string

func (*Flow) GetRequest

func (x *Flow) GetRequest() *HttpRequest

func (*Flow) GetResponse

func (x *Flow) GetResponse() *HttpResponse

func (*Flow) GetTimestamp

func (x *Flow) GetTimestamp() *timestamppb.Timestamp

func (*Flow) GetToolId

func (x *Flow) GetToolId() string

func (*Flow) ProtoMessage

func (*Flow) ProtoMessage()

func (*Flow) ProtoReflect

func (x *Flow) ProtoReflect() protoreflect.Message

func (*Flow) Reset

func (x *Flow) Reset()

func (*Flow) String

func (x *Flow) String() string

type FlowFilter

type FlowFilter struct {
	Host   string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`     // host substring
	Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // status class or code, e.g. "2xx", "404", "5xx"
	Type   string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`     // Content-Type substring
	Last   uint32 `protobuf:"varint,4,opt,name=last,proto3" json:"last,omitempty"`    // return only the last N flows (Query)
	// contains filtered or unexported fields
}

FlowFilter bounds which flows are recorded (CaptureConfig) or returned (Query).

func (*FlowFilter) Descriptor deprecated

func (*FlowFilter) Descriptor() ([]byte, []int)

Deprecated: Use FlowFilter.ProtoReflect.Descriptor instead.

func (*FlowFilter) GetHost

func (x *FlowFilter) GetHost() string

func (*FlowFilter) GetLast

func (x *FlowFilter) GetLast() uint32

func (*FlowFilter) GetStatus

func (x *FlowFilter) GetStatus() string

func (*FlowFilter) GetType

func (x *FlowFilter) GetType() string

func (*FlowFilter) ProtoMessage

func (*FlowFilter) ProtoMessage()

func (*FlowFilter) ProtoReflect

func (x *FlowFilter) ProtoReflect() protoreflect.Message

func (*FlowFilter) Reset

func (x *FlowFilter) Reset()

func (*FlowFilter) String

func (x *FlowFilter) String() string
type Header struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*Header) Descriptor deprecated

func (*Header) Descriptor() ([]byte, []int)

Deprecated: Use Header.ProtoReflect.Descriptor instead.

func (*Header) GetName

func (x *Header) GetName() string

func (*Header) GetValue

func (x *Header) GetValue() string

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) ProtoReflect

func (x *Header) ProtoReflect() protoreflect.Message

func (*Header) Reset

func (x *Header) Reset()

func (*Header) String

func (x *Header) String() string

type HttpRequest

type HttpRequest struct {
	Method   string    `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	Url      string    `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	Protocol string    `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"`
	Headers  []*Header `protobuf:"bytes,4,rep,name=headers,proto3" json:"headers,omitempty"`
	Body     []byte    `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

HttpRequest is the request half of an exchange.

func (*HttpRequest) Descriptor deprecated

func (*HttpRequest) Descriptor() ([]byte, []int)

Deprecated: Use HttpRequest.ProtoReflect.Descriptor instead.

func (*HttpRequest) GetBody

func (x *HttpRequest) GetBody() []byte

func (*HttpRequest) GetHeaders

func (x *HttpRequest) GetHeaders() []*Header

func (*HttpRequest) GetMethod

func (x *HttpRequest) GetMethod() string

func (*HttpRequest) GetProtocol

func (x *HttpRequest) GetProtocol() string

func (*HttpRequest) GetUrl

func (x *HttpRequest) GetUrl() string

func (*HttpRequest) ProtoMessage

func (*HttpRequest) ProtoMessage()

func (*HttpRequest) ProtoReflect

func (x *HttpRequest) ProtoReflect() protoreflect.Message

func (*HttpRequest) Reset

func (x *HttpRequest) Reset()

func (*HttpRequest) String

func (x *HttpRequest) String() string

type HttpResponse

type HttpResponse struct {
	StatusCode   int32     `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"`
	ReasonPhrase string    `protobuf:"bytes,2,opt,name=reason_phrase,json=reasonPhrase,proto3" json:"reason_phrase,omitempty"`
	Headers      []*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"`
	Body         []byte    `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

HttpResponse is the response half of an exchange. It is optional on Flow: a request that never got a response (timeout, refused connection, one-way capture) has no response half.

func (*HttpResponse) Descriptor deprecated

func (*HttpResponse) Descriptor() ([]byte, []int)

Deprecated: Use HttpResponse.ProtoReflect.Descriptor instead.

func (*HttpResponse) GetBody

func (x *HttpResponse) GetBody() []byte

func (*HttpResponse) GetHeaders

func (x *HttpResponse) GetHeaders() []*Header

func (*HttpResponse) GetReasonPhrase

func (x *HttpResponse) GetReasonPhrase() string

func (*HttpResponse) GetStatusCode

func (x *HttpResponse) GetStatusCode() int32

func (*HttpResponse) ProtoMessage

func (*HttpResponse) ProtoMessage()

func (*HttpResponse) ProtoReflect

func (x *HttpResponse) ProtoReflect() protoreflect.Message

func (*HttpResponse) Reset

func (x *HttpResponse) Reset()

func (*HttpResponse) String

func (x *HttpResponse) String() string

type Pair

type Pair struct {
	Name  string
	Value string
}

Pair is one HTTP header line: flat, ordered, duplicates preserved. It is the canonical header form both on the wire (proto Header) and in memory; a map cannot express order or repeated names.

func PairsFromHTTP

func PairsFromHTTP(headers http.Header) []Pair

PairsFromHTTP converts net/http headers into the canonical deterministic pair sequence used by Exchange and Flow.

func PairsFromHTTPWithHost

func PairsFromHTTPWithHost(headers http.Header, host string) []Pair

PairsFromHTTPWithHost is PairsFromHTTP plus the Host header net/http hides. The standard library parses the request-line authority into Request.Host and deletes "Host" from Request.Header, so a pair sequence built from the header map alone never carries it. When host is non-empty and no Host header is already present, it is prepended — Host conventionally leads the field block — so a request reconstructed from these pairs is complete and replayable.

type ProtocolMessage

type ProtocolMessage struct {

	// Types that are valid to be assigned to Message:
	//
	//	*ProtocolMessage_Configure
	//	*ProtocolMessage_Query
	//	*ProtocolMessage_State
	//	*ProtocolMessage_Flow
	Message isProtocolMessage_Message `protobuf_oneof:"message"`
	// contains filtered or unexported fields
}

func (*ProtocolMessage) Descriptor deprecated

func (*ProtocolMessage) Descriptor() ([]byte, []int)

Deprecated: Use ProtocolMessage.ProtoReflect.Descriptor instead.

func (*ProtocolMessage) GetConfigure

func (x *ProtocolMessage) GetConfigure() *Configure

func (*ProtocolMessage) GetFlow

func (x *ProtocolMessage) GetFlow() *Flow

func (*ProtocolMessage) GetMessage

func (x *ProtocolMessage) GetMessage() isProtocolMessage_Message

func (*ProtocolMessage) GetQuery

func (x *ProtocolMessage) GetQuery() *Query

func (*ProtocolMessage) GetState

func (x *ProtocolMessage) GetState() *State

func (*ProtocolMessage) ProtoMessage

func (*ProtocolMessage) ProtoMessage()

func (*ProtocolMessage) ProtoReflect

func (x *ProtocolMessage) ProtoReflect() protoreflect.Message

func (*ProtocolMessage) Reset

func (x *ProtocolMessage) Reset()

func (*ProtocolMessage) String

func (x *ProtocolMessage) String() string

type ProtocolMessage_Configure

type ProtocolMessage_Configure struct {
	Configure *Configure `protobuf:"bytes,10,opt,name=configure,proto3,oneof"`
}

type ProtocolMessage_Flow

type ProtocolMessage_Flow struct {
	Flow *Flow `protobuf:"bytes,13,opt,name=flow,proto3,oneof"`
}

type ProtocolMessage_Query

type ProtocolMessage_Query struct {
	Query *Query `protobuf:"bytes,11,opt,name=query,proto3,oneof"`
}

type ProtocolMessage_State

type ProtocolMessage_State struct {
	State *State `protobuf:"bytes,12,opt,name=state,proto3,oneof"`
}

type Query

type Query struct {
	State  bool        `protobuf:"varint,1,opt,name=state,proto3" json:"state,omitempty"`  // request current State
	Flows  bool        `protobuf:"varint,2,opt,name=flows,proto3" json:"flows,omitempty"`  // request recorded flows (batched Flow replies)
	Filter *FlowFilter `protobuf:"bytes,3,opt,name=filter,proto3" json:"filter,omitempty"` // filter for flows = true
	// contains filtered or unexported fields
}

Query requests a snapshot: the current State and/or the recorded flows.

func (*Query) Descriptor deprecated

func (*Query) Descriptor() ([]byte, []int)

Deprecated: Use Query.ProtoReflect.Descriptor instead.

func (*Query) GetFilter

func (x *Query) GetFilter() *FlowFilter

func (*Query) GetFlows

func (x *Query) GetFlows() bool

func (*Query) GetState

func (x *Query) GetState() bool

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) ProtoReflect

func (x *Query) ProtoReflect() protoreflect.Message

func (*Query) Reset

func (x *Query) Reset()

func (*Query) String

func (x *Query) String() string

type Request

type Request struct {
	Method   string
	URL      string
	Protocol string
	Headers  []Pair
	Body     []byte
	BodyRef  *BodyRef `json:"-"`
}

Request is the request half of an exchange.

type Response

type Response struct {
	StatusCode   int
	ReasonPhrase string
	Headers      []Pair
	Body         []byte
	BodyRef      *BodyRef `json:"-"`
}

Response is the response half of an exchange. It is optional on Exchange: a request that never got a response (timeout, refused connection, one-way capture) has no response half.

type RoutingConfig

type RoutingConfig struct {
	Mode     RoutingMode `protobuf:"varint,1,opt,name=mode,proto3,enum=aop.traffic.RoutingMode" json:"mode,omitempty"`
	Url      string      `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`           // proxy URL (PROXY) or subscription URL (SUBSCRIBE/AUTO)
	Selector string      `protobuf:"bytes,3,opt,name=selector,proto3" json:"selector,omitempty"` // node name or 1-based index (SWITCH)
	Type     string      `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`         // protocol filter, e.g. "trojan,vless" (AUTO)
	Name     string      `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"`         // node name keyword (AUTO)
	Country  string      `protobuf:"bytes,6,opt,name=country,proto3" json:"country,omitempty"`   // ISO 3166-1 alpha-2 filter, e.g. "HK,JP" (AUTO)
	Strategy string      `protobuf:"bytes,7,opt,name=strategy,proto3" json:"strategy,omitempty"` // adaptive|url-test|round-robin|random (AUTO)
	// contains filtered or unexported fields
}

RoutingConfig steers the egress chain (State in tools/proxy). Fields beyond mode/url/selector are the auto-mode subscription filters.

func (*RoutingConfig) Descriptor deprecated

func (*RoutingConfig) Descriptor() ([]byte, []int)

Deprecated: Use RoutingConfig.ProtoReflect.Descriptor instead.

func (*RoutingConfig) GetCountry

func (x *RoutingConfig) GetCountry() string

func (*RoutingConfig) GetMode

func (x *RoutingConfig) GetMode() RoutingMode

func (*RoutingConfig) GetName

func (x *RoutingConfig) GetName() string

func (*RoutingConfig) GetSelector

func (x *RoutingConfig) GetSelector() string

func (*RoutingConfig) GetStrategy

func (x *RoutingConfig) GetStrategy() string

func (*RoutingConfig) GetType

func (x *RoutingConfig) GetType() string

func (*RoutingConfig) GetUrl

func (x *RoutingConfig) GetUrl() string

func (*RoutingConfig) ProtoMessage

func (*RoutingConfig) ProtoMessage()

func (*RoutingConfig) ProtoReflect

func (x *RoutingConfig) ProtoReflect() protoreflect.Message

func (*RoutingConfig) Reset

func (x *RoutingConfig) Reset()

func (*RoutingConfig) String

func (x *RoutingConfig) String() string

type RoutingMode

type RoutingMode int32

RoutingMode selects how the egress chain is set. UNSPECIFIED leaves routing unchanged so a Configure can steer capture without touching the proxy.

const (
	RoutingMode_ROUTING_MODE_UNSPECIFIED RoutingMode = 0
	RoutingMode_ROUTING_MODE_DIRECT      RoutingMode = 1 // revert to the original/direct egress
	RoutingMode_ROUTING_MODE_PROXY       RoutingMode = 2 // single proxy URL (url)
	RoutingMode_ROUTING_MODE_SUBSCRIBE   RoutingMode = 3 // load a clash subscription (url), no switch
	RoutingMode_ROUTING_MODE_AUTO        RoutingMode = 4 // subscription + adaptive load balancing
	RoutingMode_ROUTING_MODE_SWITCH      RoutingMode = 5 // switch active node within a loaded subscription
	RoutingMode_ROUTING_MODE_CLEAR       RoutingMode = 6 // clear subscription, revert to original
)

func (RoutingMode) Descriptor

func (RoutingMode) Enum

func (x RoutingMode) Enum() *RoutingMode

func (RoutingMode) EnumDescriptor deprecated

func (RoutingMode) EnumDescriptor() ([]byte, []int)

Deprecated: Use RoutingMode.Descriptor instead.

func (RoutingMode) Number

func (x RoutingMode) Number() protoreflect.EnumNumber

func (RoutingMode) String

func (x RoutingMode) String() string

func (RoutingMode) Type

type RoutingState

type RoutingState struct {
	ActiveNode string `protobuf:"bytes,1,opt,name=active_node,json=activeNode,proto3" json:"active_node,omitempty"`
	EgressUrl  string `protobuf:"bytes,2,opt,name=egress_url,json=egressUrl,proto3" json:"egress_url,omitempty"`
	Auto       bool   `protobuf:"varint,3,opt,name=auto,proto3" json:"auto,omitempty"`
	// contains filtered or unexported fields
}

func (*RoutingState) Descriptor deprecated

func (*RoutingState) Descriptor() ([]byte, []int)

Deprecated: Use RoutingState.ProtoReflect.Descriptor instead.

func (*RoutingState) GetActiveNode

func (x *RoutingState) GetActiveNode() string

func (*RoutingState) GetAuto

func (x *RoutingState) GetAuto() bool

func (*RoutingState) GetEgressUrl

func (x *RoutingState) GetEgressUrl() string

func (*RoutingState) ProtoMessage

func (*RoutingState) ProtoMessage()

func (*RoutingState) ProtoReflect

func (x *RoutingState) ProtoReflect() protoreflect.Message

func (*RoutingState) Reset

func (x *RoutingState) Reset()

func (*RoutingState) String

func (x *RoutingState) String() string

type State

type State struct {
	Routing *RoutingState `protobuf:"bytes,1,opt,name=routing,proto3" json:"routing,omitempty"`
	Capture *CaptureState `protobuf:"bytes,2,opt,name=capture,proto3" json:"capture,omitempty"`
	Error   string        `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

State is the runner's reply to Configure/Query.

func (*State) Descriptor deprecated

func (*State) Descriptor() ([]byte, []int)

Deprecated: Use State.ProtoReflect.Descriptor instead.

func (*State) GetCapture

func (x *State) GetCapture() *CaptureState

func (*State) GetError

func (x *State) GetError() string

func (*State) GetRouting

func (x *State) GetRouting() *RoutingState

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) ProtoReflect

func (x *State) ProtoReflect() protoreflect.Message

func (*State) Reset

func (x *State) Reset()

func (*State) String

func (x *State) String() string

type WebSocketExchange

type WebSocketExchange struct {
	ID        string
	URL       string
	Protocol  string
	Headers   []Pair
	Messages  []WebSocketMessage
	StartTime time.Time
	EndTime   time.Time
	Complete  bool
	Error     string
}

WebSocketExchange contains the handshake metadata and message stream for a WebSocket connection. The HTTP handshake itself can still be represented by Exchange; this type is for the bidirectional messages that follow it.

type WebSocketMessage

type WebSocketMessage struct {
	Direction string
	Type      string
	Body      []byte
	Timestamp time.Time
}

WebSocketMessage is a single message observed after an HTTP WebSocket handshake. WebSocket traffic is deliberately modeled separately from an HTTP Exchange while sharing the same header pair representation.

Jump to

Keyboard shortcuts

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