hayzam 7a3f6e945d Improves flow handling and adds runtime stats APIs
Refactors TCP and UDP flow managers to enhance analyzer selection and flow binding accuracy, including O(1) UDP stream rebinding by 5-tuple.
Introduces runtime stats tracking for engine and ruleset operations, exposing new APIs for granular performance and error metrics.
Optimizes GeoMatcher with result caching and supports efficient geosite set matching, reducing redundant computation in ruleset expressions.
2026-05-13 06:10:38 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30
2026-02-11 06:27:36 +05:30

Mellaris

Mellaris is a Go library for network stream analysis and filtering.

Usage

package main

import (
	"context"

	"git.difuse.io/Difuse/Mellaris"
)

func main() {
	cfg := mellaris.Config{
		IO: mellaris.IOConfig{
			// QueueSize, ReadBuffer, WriteBuffer, Local, RST
		},
		Workers: mellaris.WorkersConfig{
			// Count, QueueSize, TCPMaxBufferedPagesTotal, TCPMaxBufferedPagesPerConn, UDPMaxStreams
		},
		Ruleset: mellaris.RulesetConfig{
			GeoIp:   "/path/to/geoip.dat",
			GeoSite: "/path/to/geosite.dat",
		},
	}

	app, err := mellaris.New(cfg, mellaris.Options{
		RulesFile: "rules.yaml",
		Analyzers: mellaris.DefaultAnalyzers(),
		Modifiers: mellaris.DefaultModifiers(),
	})
	if err != nil {
		panic(err)
	}
	defer app.Close()

	_ = app.Run(context.Background())
}

Testing

Run all tests:

go test ./...

Run tests with coverage:

go test -cover ./...                              # per-package summary
go test -coverprofile=coverage.out ./...          # full profile
go tool cover -html=coverage.out -o coverage.html # HTML report

Run tests for a specific package:

go test -v ./analyzer/tcp/
go test -v -run TestSSH ./analyzer/tcp/

Based on OpenGFW by apernet: https://github.com/apernet/OpenGFW

LICENSE

MPL-2.0

S
Description
No description provided
Readme MPL-2.0 9.8 MiB
Languages
Go 100%