trustsrc

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 4 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 trustsrc 登记各模块确认过身份的来源地址(如用正确令牌登录 frps 的 frpc), 入侵防护的诱饵端口与扫描检测不统计这些来源。

家宽出口地址往往由一个局域网里的多台设备共用:其中一台设备的点对点组网程序做 TCP 打洞时, 会在一分钟内向服务器的大量未开放端口发起连接,被扫描检测当成端口扫描封禁, 同一出口地址上的 frpc 也随之断开。登记在这里的来源只是免于这两种按端口判断的检测, 日志规则、访问控制等其他封禁照常生效。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(owner string)

Clear 删除 owner 的登记。

func Notify

func Notify() <-chan struct{}

Notify 返回登记内容变化的通知通道。多次变化合并为一个信号,使用方收到后重新读取 All。

func Set

func Set(owner string, list []Source)

Set 设置 owner 登记的来源,覆盖之前的登记;列表为空时等同 Clear。无效地址会被忽略。

Types

type Source

type Source struct {
	// Addr 为来源地址
	Addr netip.Addr
	// Port 不为 0 时,只要来源与本机 TCP 端口 Port 之间有已建立的连接就视为可信(如 frpc 到 frps 的控制连接)
	Port int
	// Until 之前无论是否有连接都视为可信,用于覆盖连接刚断开、客户端正在重连的空档
	Until time.Time
}

Source 是一个可信来源。

func All

func All() []Source

All 返回全部登记的来源。

Jump to

Keyboard shortcuts

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