netguard

package
v0.1.4449 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package netguard is the one rule for where a download of a URL magpie didn't choose may connect: the gateway's (a caller's image, web_fetch, a vendor's image or video, generate_image's download) and a provider's icon. It judges addresses only; each caller decides what to do with a name's answers (pin them, or hand a proxy the name).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FakeIP

func FakeIP(a netip.Addr) bool

FakeIP says a is in 198.18.0.0/15, RFC 2544's benchmarking range, where Clash's TUN mode with fake-ip, Clash Verge, Surge's enhanced mode and Loon answer every name, and carry a connection to it to the real host the name stands for (#252, #2593). No machine on the user's network sits there, so a connection to a fake-IP answer reaches the internet host the name stands for, or nothing; but which host that is, the fake-IP resolver decides where magpie can't see.

func FakePaired added in v0.1.3336

func FakePaired(a netip.Addr, answers []netip.Addr) bool

FakePaired says a is the AAAA answer a fake-IP resolver gives beside its fake A answer: an IPv6 address in fc00::/7 or 2001:2::/48 (RFC 5180's benchmarking range) while answers hold an IPv4 one in 198.18.0.0/15 (FakeIP). mihomo answers AAAA from its fake-ip-range6 when IPv6 is on, and Clash Verge Rev turns it on by default with fdfe:dcba:9876::1/64, or fills in 2001:2::/64; sing-box's inet6_range is a ULA as a rule (jiezhengj on Discord, 11-08: every web_fetch refused under Clash Verge Rev's TUN). Such an a is not dialled: the fake A answer is judged, and pinned, in its place, so it reaches nothing a fake A answer alone wouldn't. Without a fake A answer beside it, a ULA is private as ever.

func LoonPaired

func LoonPaired(a netip.Addr, answers []netip.Addr) bool

LoonPaired says a is the AAAA record Loon synthesizes for an A answer (its IPv4 address inside fd27:712::/96) and that A answer is among answers. Such an a stands for that IPv4 address, which the caller judges on its own; a is not dialled. An unpaired one, or any other fc00::/7 address, is private as ever.

func Public

func Public(a netip.Addr) bool

Public says a is on the open internet: not loopback, RFC 1918, fc00::/7, link-local (169.254.169.254 among them), CGNAT, unspecified, multicast, documentation, reserved, benchmarking, Teredo, nor an IPv4-mapped, NAT64 or 6to4 form of one. A fake-IP resolver's answer is not public (FakeIP says when it may be fetched from all the same).

Types

This section is empty.

Jump to

Keyboard shortcuts

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