How mmx233/bitsrunlogingo works
BitSrunLoginGo is a command-line campus-network login client, with a reusable pkg/srun login library. The main path loads configuration, optionally runs a guardian loop, selects interfaces, detects portal parameters, checks login status, and authenticates when needed; successful login can trigger DDNS. The README also documents multi-interface operation, automatic acid/enc detection, Reality requests, backoff, and three DNS providers. Links reflect the excerpted callers and explicit README behavior; provider-specific and several configuration details are indexed but not excerpted.
Main entry points: login.go Login orchestration · main.go CLI entry · dns.go DDNS dispatch · config.go Configuration
Components 21
Command and config
- CLI entry
cmd/bitsrun/main.go - Configuration
internal/config/config.go - Config defaults
internal/config/default.go - Logging
internal/config/log.go
Login orchestration
- Guardian loop
internal/login/guardian.go - Login orchestration
internal/login/login.go - Interface selection
internal/login/login.go - Retry backoff
internal/config/backoff.go - Network interfaces
tools/eth.go
Srun protocol
- Srun client
pkg/srun/srun.go - Portal API
pkg/srun/api.go - Portal detection
pkg/srun/detect.go - Protocol encoding
pkg/srun/encode.go
Network and DDNS
- HTTP client
internal/http_client/http.go - DDNS dispatch
internal/dns/dns.go - Cloudflare provider
internal/dns/cloudflare/cloudflare.go - Aliyun provider
internal/dns/aliyun/aliyun.go - DNSPod provider
internal/dns/dnspod/dnspod.go
Other components
- Operator
- Campus portal
- DNS services
Connections 24
- Operator → CLI entry: runs
README.md - CLI entry → Configuration: loads
cmd/bitsrun/main.go - Configuration → Config defaults: initializes from
internal/config/config.go - Configuration → Logging: configures
- CLI entry → Guardian loop: starts
cmd/bitsrun/main.go - CLI entry → Login orchestration: invokes
cmd/bitsrun/main.go - Guardian loop → Login orchestration: repeats
internal/login/guardian.go - Login orchestration → Interface selection: dispatches
internal/login/login.go - Interface selection → Login orchestration: runs per interface
internal/login/login.go - Interface selection → Network interfaces: enumerates
internal/login/login.go - Login orchestration → Retry backoff: runs with retries
internal/login/login.go - Login orchestration → HTTP client: selects client
internal/login/login.go - Login orchestration → Srun client: checks and authenticates
internal/login/login.go - Srun client → Portal API: uses
- Login orchestration → Portal detection: detects parameters
internal/login/login.go - Srun client → Protocol encoding: encodes requests
- Portal API → Campus portal: requests status and login
- Login orchestration → DDNS dispatch: updates after login
internal/login/login.go - DDNS dispatch → Aliyun provider: dispatches
internal/dns/dns.go - DDNS dispatch → Cloudflare provider: dispatches
internal/dns/dns.go - DDNS dispatch → DNSPod provider: dispatches
internal/dns/dns.go - Aliyun provider → DNS services: updates records
- Cloudflare provider → DNS services: updates records
- DNSPod provider → DNS services: updates records