proxy_scan

command
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 5 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.

README

代理扫描示例(v3.0 Engine API + per-host 限流)

本示例演示通过 HTTP/SOCKS5 代理扫描 + per-host 速率限制。

运行

cd example/proxy_scan
go run main.go

核心代码

engine, _ := sdk.NewEngine(ctx,
    sdk.WithFingerOptions(options),
    sdk.WithProxy("http://127.0.0.1:8080"),  // HTTP 代理
    // sdk.WithProxy("socks5://127.0.0.1:1080"), // SOCKS5 代理
    sdk.WithTimeout(10*time.Second),
    sdk.WithRateLimit(20, 30),  // 20 QPS / burst 30
)
defer engine.Close()

per-host 限流原理

每个目标 host 持有独立的令牌桶(golang.org/x/time/rate.Limiter),LRU 缓存最近 512 个 host:

  • 桶按 qps 速率匀速产生令牌
  • 每次 Scan 阻塞直到 host 桶有可用令牌
  • 不同 host 互不影响,避免高并发把单个目标打挂

调试

import "github.com/cyberspacesec/gxx/sdk/debug"

stats := debug.HostRateLimiterStatsOf(engine)
fmt.Printf("enabled=%v cached=%d qps=%.1f burst=%d\n",
    stats.Enabled, stats.CachedHosts, stats.QPS, stats.Burst)

Documentation

Overview

proxy_scan 演示通过 HTTP / SOCKS5 代理扫描,并启用 per-host 限流。

  • WithProxy 设置代理地址
  • WithRateLimit 启用每 host 令牌桶

Jump to

Keyboard shortcuts

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