r2libs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgumentError

func ArgumentError(function string, expected string, received int)

ArgumentError generates an improved argument error

func MathError

func MathError(function string, operation string, value interface{})

MathError generates specific mathematical errors

func RegisterCSV

func RegisterCSV(env *r2core.Environment)

func RegisterCollections

func RegisterCollections(env *r2core.Environment)

func RegisterConcurrency

func RegisterConcurrency(env *r2core.Environment)

func RegisterConsole

func RegisterConsole(env *r2core.Environment)

func RegisterDB

func RegisterDB(env *r2core.Environment)

func RegisterDate

func RegisterDate(env *r2core.Environment)

func RegisterGRPC

func RegisterGRPC(env *r2core.Environment)

RegisterGRPC registers gRPC functions in R2Lang environment

func RegisterGoInterOp

func RegisterGoInterOp(env *r2core.Environment)

RegisterGoInterOp: expone funciones que permiten a R2 usar el registro

func RegisterHTTP

func RegisterHTTP(env *r2core.Environment)

func RegisterHTTPClient

func RegisterHTTPClient(env *r2core.Environment)

func RegisterHack

func RegisterHack(env *r2core.Environment)

func RegisterIO

func RegisterIO(env *r2core.Environment)

func RegisterJSON

func RegisterJSON(env *r2core.Environment)

func RegisterJWT

func RegisterJWT(env *r2core.Environment)

func RegisterLib

func RegisterLib(env *r2core.Environment)

func RegisterMath

func RegisterMath(env *r2core.Environment)

func RegisterModule

func RegisterModule(env *r2core.Environment, moduleName string, functions map[string]r2core.BuiltinFunction)

RegisterModule registers a module with its functions under a namespace

func RegisterOS

func RegisterOS(env *r2core.Environment)

func RegisterPrint

func RegisterPrint(env *r2core.Environment)

func RegisterRand

func RegisterRand(env *r2core.Environment)

func RegisterRequests

func RegisterRequests(env *r2core.Environment)

func RegisterSOAP

func RegisterSOAP(env *r2core.Environment)

RegisterSOAP registers SOAP functions in R2Lang environment

func RegisterStd

func RegisterStd(env *r2core.Environment)

func RegisterString

func RegisterString(env *r2core.Environment)

func RegisterTest

func RegisterTest(env *r2core.Environment)

func RegisterUnicode

func RegisterUnicode(env *r2core.Environment)

func RegisterXML

func RegisterXML(env *r2core.Environment)

func TypeArgumentError

func TypeArgumentError(function string, argIndex int, expected string, received interface{})

TypeArgumentError generates an improved type argument error

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

BasicAuth represents HTTP Basic Authentication

type CommandObject

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

CommandObject represents an external command with a fluent API.

func (*CommandObject) Eval

func (c *CommandObject) Eval(env *r2core.Environment) interface{}

func (*CommandObject) Getattr

func (c *CommandObject) Getattr(name string) (r2core.Node, bool)

type ContentType

type ContentType int

ContentType representa el tipo de contenido detectado.

const (
	Unknown ContentType = iota
	JSONType
	XMLType
	HTMLType
	TextType
)

func DetectContentType

func DetectContentType(input string) ContentType

DetectContentType determina si una cadena es JSON, XML, HTML o Texto Plano.

func (ContentType) String

func (c ContentType) String() string

String convierte el ContentType a una representación en string.

type FileStreamObject

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

FileStreamObject represents a stream of lines from a file with fluent operations.

func (*FileStreamObject) Eval

func (fs *FileStreamObject) Eval(env *r2core.Environment) interface{}

func (*FileStreamObject) Getattr

func (fs *FileStreamObject) Getattr(name string) (r2core.Node, bool)

type GRPCAuth

type GRPCAuth struct {
	Type     string // "bearer", "basic", "mtls", "custom"
	Token    string
	Username string
	Password string
	CertFile string
	KeyFile  string
	CAFile   string
	Metadata map[string]string
}

GRPCAuth represents authentication configuration for gRPC

type GRPCClient

type GRPCClient struct {
	ProtoFile   string
	ServerAddr  string
	FileDesc    *desc.FileDescriptor
	Services    map[string]*GRPCService
	Connection  *grpc.ClientConn
	Timeout     time.Duration
	Metadata    map[string]string
	TLSConfig   *tls.Config
	UseTLS      bool
	Auth        *GRPCAuth
	Compression string
	// contains filtered or unexported fields
}

GRPCClient represents a dynamic gRPC client

type GRPCMethod

type GRPCMethod struct {
	Name            string
	InputType       string
	OutputType      string
	ClientStreaming bool
	ServerStreaming bool
	Desc            *desc.MethodDescriptor
}

GRPCMethod represents a gRPC method with its details

type GRPCService

type GRPCService struct {
	Name    string
	Methods map[string]*GRPCMethod
	Desc    *desc.ServiceDescriptor
}

GRPCService represents a gRPC service with its methods

type GRPCStream

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

GRPCStream represents a gRPC streaming connection

type GoObject

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

Estructura que podemos usar para simular objetos Go Se crea con "goNew('MyStruct')" y se guarda en un *GoObject

func (*GoObject) Eval

func (g *GoObject) Eval(env *r2core.Environment) interface{}

Eval => no hace nada especial

type Graph

type Graph struct {
	Edges      map[string][]string
	Debug      bool
	ReverseMap map[string][]string // Cached reverse edges for efficient descendant queries
}

Graph represents a directed graph for knowledge representation.

func NewGraph

func NewGraph() *Graph

NewGraph initializes a new graph.

func (*Graph) AddBidirectionalEdge

func (g *Graph) AddBidirectionalEdge(node1, node2 string)

AddBidirectionalEdge adds a bidirectional edge.

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to string)

AddEdge adds a directed edge to the graph.

func (*Graph) EnableDebug

func (g *Graph) EnableDebug()

EnableDebug enables debug mode.

func (*Graph) GetAncestors

func (g *Graph) GetAncestors(node string) []string

GetAncestors finds all ancestors of a node using DFS.

func (*Graph) GetDescendants

func (g *Graph) GetDescendants(node string) []string

GetDescendants finds all descendants of a node using DFS.

func (*Graph) GetRelationshipLevel

func (g *Graph) GetRelationshipLevel(start, end string) int

GetRelationshipLevel finds the shortest distance between two nodes.

func (*Graph) GetShortestPath

func (g *Graph) GetShortestPath(start, end string) []string

GetShortestPath finds the shortest path between two nodes using BFS.

type Monitor

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

Monitor estructura

func NewMonitor

func NewMonitor() *Monitor

NewMonitor crea un nuevo monitor

func (*Monitor) Broadcast

func (m *Monitor) Broadcast()

Broadcast despierta todas las goroutines esperando en la condición

func (*Monitor) Lock

func (m *Monitor) Lock()

Lock adquiere el mutex del monitor

func (*Monitor) Signal

func (m *Monitor) Signal()

Signal despierta una goroutine esperando en la condición

func (*Monitor) Unlock

func (m *Monitor) Unlock()

Unlock libera el mutex del monitor

func (*Monitor) Wait

func (m *Monitor) Wait()

Wait espera en la condición del monitor

type NativeFunction

type NativeFunction struct {
	Fn r2core.BuiltinFunction
}

PathObject represents a file system path with a fluent API.

func (*NativeFunction) Eval

func (nf *NativeFunction) Eval(env *r2core.Environment) interface{}

type PathObject

type PathObject struct {
	Path string
}

PathObject represents a file system path with a fluent API.

func (*PathObject) Eval

func (p *PathObject) Eval(env *r2core.Environment) interface{}

func (*PathObject) Getattr

func (p *PathObject) Getattr(name string) (r2core.Node, bool)

type R2Process

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

Estructura para guardar referencia a un proceso lanzado en background

func (*R2Process) Eval

func (rp *R2Process) Eval(env *r2core.Environment) interface{}

R2Process Eval => no hace nada, solo devolvemos algo representativo

type Response

type Response struct {
	URL        string
	StatusCode int
	Headers    map[string]interface{}
	Text       string
	JSON       interface{}
	Content    []byte
	OK         bool
	Elapsed    time.Duration
}

Response represents an HTTP response with Python requests-like interface

type SOAPAuth

type SOAPAuth struct {
	Type     string // "basic", "bearer", "certificate"
	Username string
	Password string
	Token    string
	CertFile string
	KeyFile  string
}

SOAPAuth represents authentication configuration

type SOAPClient

type SOAPClient struct {
	WSDLURL       string
	ServiceURL    string
	Namespace     string
	Operations    map[string]*SOAPOperation
	HTTPTimeout   time.Duration
	Headers       map[string]string
	TLSConfig     *tls.Config
	SkipTLSVerify bool
	Auth          *SOAPAuth
}

SOAPClient represents a dynamic SOAP client

type SOAPOperation

type SOAPOperation struct {
	Name         string
	SOAPAction   string
	InputMessage string
	Parameters   []SOAPParameter
}

SOAPOperation represents a SOAP operation with its parameters

type SOAPParameter

type SOAPParameter struct {
	Name string
	Type string
}

SOAPParameter represents a parameter for a SOAP operation

type Semaphore

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

Semaphore estructura

func NewSemaphore

func NewSemaphore(permits int) *Semaphore

NewSemaphore crea un nuevo semáforo con el número dado de permisos

func (*Semaphore) Acquire

func (s *Semaphore) Acquire()

Acquire obtiene un permiso del semáforo

func (*Semaphore) Release

func (s *Semaphore) Release()

Release libera un permiso del semáforo

type Session

type Session struct {
	Client     *http.Client
	Headers    map[string]string
	Auth       *BasicAuth
	Timeout    time.Duration
	Verify     bool
	BaseURL    string
	Proxies    map[string]string
	MaxRetries int
	RetryDelay time.Duration
}

Session represents an HTTP session for reusing connections and settings

type WSDLBinding

type WSDLBinding struct {
	Name       string                 `xml:"name,attr"`
	Type       string                 `xml:"type,attr"`
	Operations []WSDLBindingOperation `xml:"operation"`
}

WSDLBinding represents a WSDL binding

type WSDLBindingOperation

type WSDLBindingOperation struct {
	Name       string         `xml:"name,attr"`
	SOAPAction WSDLSoapAction `xml:"operation"`
}

WSDLBindingOperation represents a WSDL binding operation

type WSDLDefinitions

type WSDLDefinitions struct {
	XMLName   xml.Name       `xml:"definitions"`
	TargetNS  string         `xml:"targetNamespace,attr"`
	Services  []WSDLService  `xml:"service"`
	PortTypes []WSDLPortType `xml:"portType"`
	Bindings  []WSDLBinding  `xml:"binding"`
	Messages  []WSDLMessage  `xml:"message"`
	Types     WSDLTypes      `xml:"types"`
}

WSDLDefinitions represents the root element of a WSDL document

type WSDLElement

type WSDLElement struct {
	Name string `xml:"name,attr"`
	Type string `xml:"type,attr"`
}

WSDLElement represents a WSDL element

type WSDLMessage

type WSDLMessage struct {
	Name  string     `xml:"name,attr"`
	Parts []WSDLPart `xml:"part"`
}

WSDLMessage represents a WSDL message

type WSDLOperation

type WSDLOperation struct {
	Name   string      `xml:"name,attr"`
	Input  WSDLMessage `xml:"input"`
	Output WSDLMessage `xml:"output"`
}

WSDLOperation represents a WSDL operation

type WSDLPart

type WSDLPart struct {
	Name    string `xml:"name,attr"`
	Element string `xml:"element,attr"`
	Type    string `xml:"type,attr"`
}

WSDLPart represents a WSDL message part

type WSDLPort

type WSDLPort struct {
	Name    string          `xml:"name,attr"`
	Address WSDLSoapAddress `xml:"address"`
}

WSDLPort represents a WSDL port

type WSDLPortType

type WSDLPortType struct {
	Name       string          `xml:"name,attr"`
	Operations []WSDLOperation `xml:"operation"`
}

WSDLPortType represents a WSDL port type

type WSDLSchema

type WSDLSchema struct {
	Elements []WSDLElement `xml:"element"`
}

WSDLSchema represents a WSDL schema

type WSDLService

type WSDLService struct {
	Name  string     `xml:"name,attr"`
	Ports []WSDLPort `xml:"port"`
}

WSDLService represents a WSDL service

type WSDLSoapAction

type WSDLSoapAction struct {
	SOAPAction string `xml:"soapAction,attr"`
}

WSDLSoapAction represents a SOAP action

type WSDLSoapAddress

type WSDLSoapAddress struct {
	Location string `xml:"location,attr"`
}

WSDLSoapAddress represents a SOAP address

type WSDLTypes

type WSDLTypes struct {
	Schemas []WSDLSchema `xml:"schema"`
}

WSDLTypes represents WSDL types

type XMLNode

type XMLNode struct {
	Name       string            `xml:"-"`
	Content    string            `xml:",chardata"`
	Attributes map[string]string `xml:"-"`
	Children   []*XMLNode        `xml:"-"`
}

XMLNode represents an XML node

Jump to

Keyboard shortcuts

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