httpql

package
v0.0.0-...-d48f94d Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertLikeToRegex

func ConvertLikeToRegex(like string) string

Types

type BoolExpr

type BoolExpr struct {
	Value    bool
	Operator BoolOp
}

func (*BoolExpr) Eval

func (b *BoolExpr) Eval(val bool) bool

func (*BoolExpr) String

func (b *BoolExpr) String() string

type BoolOp

type BoolOp string
const (
	OpBoolEq BoolOp = "eq"
	OpBoolNe BoolOp = "ne"
)

type IntExpr

type IntExpr struct {
	Value    int
	Operator IntOp
}

func (*IntExpr) Eval

func (i *IntExpr) Eval(val int) bool

func (*IntExpr) String

func (i *IntExpr) String() string

type IntOp

type IntOp string
const (
	OpIntEq  IntOp = "eq"
	OpIntNe  IntOp = "ne"
	OpIntGt  IntOp = "gt"
	OpIntGte IntOp = "gte"
	OpIntLt  IntOp = "lt"
	OpIntLte IntOp = "lte"
)

type Lexer

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

func NewLexer

func NewLexer(input string) *Lexer

func (*Lexer) NextToken

func (l *Lexer) NextToken() Token

type Parser

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

func NewParser

func NewParser(l *Lexer) *Parser

func (*Parser) ParseQuery

func (p *Parser) ParseQuery() (*Query, error)

type Query

type Query struct {
	Req  *RequestClause
	Resp *ResponseClause
	// Logical operations
	And []*Query
	Or  []*Query
}

func (*Query) Eval

func (q *Query) Eval(f *proxy.Flow) bool

func (*Query) String

func (q *Query) String() string

type RequestClause

type RequestClause struct {
	Method *StringExpr
	Host   *StringExpr
	Path   *StringExpr
	Query  *StringExpr
	Body   *StringExpr // Alias: raw
	Port   *IntExpr
	IsTLS  *BoolExpr
}

func (*RequestClause) Eval

func (r *RequestClause) Eval(f *proxy.Flow) bool

func (*RequestClause) String

func (r *RequestClause) String() string

type ResponseClause

type ResponseClause struct {
	StatusCode *IntExpr
	Body       *StringExpr // Alias: raw
	Length     *IntExpr
}

func (*ResponseClause) Eval

func (r *ResponseClause) Eval(f *proxy.Flow) bool

func (*ResponseClause) String

func (r *ResponseClause) String() string

type StringExpr

type StringExpr struct {
	Value    string
	Operator StringOp
}

func (*StringExpr) Eval

func (s *StringExpr) Eval(val string) bool

func (*StringExpr) String

func (s *StringExpr) String() string

type StringOp

type StringOp string
const (
	OpEq     StringOp = "eq"
	OpNe     StringOp = "ne"
	OpCont   StringOp = "cont"
	OpNCont  StringOp = "ncont"
	OpLike   StringOp = "like"
	OpNLike  StringOp = "nlike"
	OpRegex  StringOp = "regex"
	OpNRegex StringOp = "nregex"
)

type Token

type Token struct {
	Type    TokenType
	Literal string
	Pos     int
}

type TokenType

type TokenType int
const (
	TOKEN_EOF TokenType = iota
	TOKEN_IDENT
	TOKEN_STRING
	TOKEN_INT
	TOKEN_DOT
	TOKEN_COLON
	TOKEN_LPAREN
	TOKEN_RPAREN
	TOKEN_AND
	TOKEN_OR
	TOKEN_NOT
)

Jump to

Keyboard shortcuts

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