relintio

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 9 Imported by: 0

README

Relintio Go WAF Protection Agent SDK

Official Go middleware and SDK for integrating the Relintio WAF protection system.

Installation

go get github.com/Relintio/relintio-golang-agent

Features

  • Rule Cache Sync: Periodically syncs active rules in a thread-safe background routine.
  • WAF Check Engine: Instant threat analysis against local cached rules.
  • Middleware Adapters: Built-in middleware for standard net/http and the gin framework.
  • Telemetry Loop: Non-blocking telemetry reporting back to the Relintio console.

Quickstart

Standard net/http Integration
package main

import (
    "net/http"
    "time"
    "github.com/Relintio/relintio-golang-agent"
)

func main() {
    agent := relintio.NewAgent(relintio.Config{
        LicenseKey:   "YOUR_LICENSE_KEY",
        ApiUrl:       "https://api.relintio.com/api",
        SyncInterval: 60 * time.Second,
    })
    
    agent.StartSync()

    mux := http.NewServeMux()
    mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
        w.Write([]byte("Protected by Relintio"))
    })

    // Apply the standard middleware
    protectedHandler := relintio.Middleware(agent)(mux)

    http.ListenAndServe(":8080", protectedHandler)
}
Gin Integration
package main

import (
    "github.com/gin-gonic/gin"
    "github.com/Relintio/relintio-golang-agent"
)

func main() {
    agent := relintio.NewAgent(relintio.Config{
        LicenseKey: "YOUR_LICENSE_KEY",
    })
    agent.StartSync()

    r := gin.Default()
    r.Use(relintio.GinMiddleware(agent))

    r.GET("/", func(c *gin.Context) {
        c.String(200, "Secure Route")
    })

    r.Run(":8080")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinMiddleware

func GinMiddleware(agent *Agent) gin.HandlerFunc

func Middleware

func Middleware(agent *Agent) func(http.Handler) http.Handler

Types

type Agent

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

func NewAgent

func NewAgent(cfg Config) *Agent

func (*Agent) CheckRequest

func (a *Agent) CheckRequest(r *http.Request) ThreatResult

func (*Agent) SendTelemetry

func (a *Agent) SendTelemetry(r *http.Request, result ThreatResult)

func (*Agent) StartSync

func (a *Agent) StartSync()

type Config

type Config struct {
	LicenseKey   string
	ApiUrl       string
	SyncInterval time.Duration
}

type Rule

type Rule struct {
	ID        string `json:"id"`
	Type      string `json:"type"`      // "ip", "user_agent", "path", "header"
	Pattern   string `json:"pattern"`   // Value to match
	Action    string `json:"action"`    // "block", "challenge", "allow"
	Condition string `json:"condition"` // "equals", "contains", "regex"
	Score     int    `json:"score"`
}

type RuleResponse

type RuleResponse struct {
	Rules []Rule `json:"rules"`
}

type ThreatResult

type ThreatResult struct {
	Score  int
	Action string
}

Directories

Path Synopsis
examples
gin_demo command

Jump to

Keyboard shortcuts

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