主站 acf_* 登录 cookie 实测仅约 6 天有效(Set-Cookie Max-Age=529200s),过期后取流降级、 弹幕登录失败且只能重新扫码。本功能用 passport 域的长期票据 LTP0 走 safeAuth 换票链自动续命。 - configs: 新增 douyu_auth(LTP0/DyDid/续期日程);Marshal 改 temp+fsync+rename 原子写并 Chmod 0600, rename 或建临时文件失败才回退原地写(Docker 单文件挂载场景);cookie 域名别名(douyu.com/m.douyu.com) 入库统一归一到 www.douyu.com;写盘前从 cookie 串剥离 LTP0;凭证三处出口全部掩码 (/api/config 走 json:"-"、raw-config 走 __BILILIVE_DOUYU_SECRET_HIDDEN__、debug 转储走 CloneForLog) - live/douyu/refresh.go: 手动逐跳跟随 302 累积 Set-Cookie(8 跳上限、跳过空值), 只放行 https 且 *.douyu.com 的跳点(douyu.com.evil.com、裸 http、片段藏域名一律拒绝), 终点必须 200 且 follow/top3 探针返回 error=0 才算成功;非 200 归为临时错误、缺必需字段才判失效; 字段级合并 + 设备号策略(dy_did/acf_did/acf_devid 复用旧值),合并结果按字段名有序写回避免无意义配置 diff - 阈值调度:3d 到点续期、临时失败 6h 退避、判失效 24h、连败 6d 升档;cookie 确凿过期前不发取流请求 - servers/douyu_keeper.go: 30s 首检 + 每小时廉价检查,仅在存有 LTP0 时真正换票; 续期结果只在 CAS 闭包内合并并校验 LTP0 归属(旧票据的迟到结果直接作废); 失效只置 need_rescan 不清 LTP0,告警按 LTP0 去重且推送走独立 goroutine 不阻塞续期循环 - servers/handler.go: raw-config 区分"该节未提交"与"显式清空"、按 acf_uid 判换号、带锁提交并支持版本冲突重试; putLiveHostCookie 不误清长期票据;新增 GET /api/douyu/auth/status 供前端显示登录态与下次续期时间; B 站 pollBilibiliQRCode 保留上游原有字段(不再因结构体重序列化丢 refresh_token)并把 Set-Cookie 登录字段拼进 data.cookies - notify: 新增 SendSystemAlert,斗鱼需重新扫码时按已配渠道推送 - cmd/bililive: 启动 keeper 且不依赖 Web RPC 是否启用,保证无界面后台长期保活 - webapp: 斗鱼面板显示登录态/续期日程并做轮询会话隔离,房间列表标记登录态; B 站扫码成功后回填 cookie 并提示未落盘的后果 - 测试:新增 6 个文件覆盖换票链分类、失效与退避升档、掩码出口、原子写与回退、别名归一、设备号复用 (全部 httptest/合成值,不触网、不含真实凭证) - go.mod: google/uuid 由 indirect 归位为 direct(handler 直接引用) 实测记录:真机换票链有效态 302→200 JSONP+17 个 Set-Cookie、垃圾票据态 200 JSONP+零 cookie; 临时实例 30s 首检续期成功并热应用后,斗鱼原画以 60fps 连续录制跨过 5 分钟分段; 垃圾 LTP0 走 need_rescan + 5.99h 退避,原 cookie 与票据均未被破坏。
119 lines
5.3 KiB
AMPL
119 lines
5.3 KiB
AMPL
module github.com/bililive-go/bililive-go
|
|
|
|
go 1.25
|
|
|
|
require (
|
|
github.com/Masterminds/semver/v3 v3.4.0
|
|
github.com/Masterminds/sprig v2.22.0+incompatible
|
|
github.com/Microsoft/go-winio v0.6.2
|
|
github.com/alecthomas/kingpin v2.2.7-0.20180312062423-a39589180ebd+incompatible
|
|
github.com/andybalholm/brotli v1.1.0
|
|
github.com/bluele/gcache v0.0.0-20190518031135-bc40bd653833
|
|
github.com/bluenviron/mediacommon/v2 v2.7.2
|
|
github.com/dop251/goja v0.0.0-20260311135729-065cd970411c
|
|
github.com/getsentry/sentry-go v0.31.1
|
|
github.com/go-delve/delve v1.26.0
|
|
github.com/golang-migrate/migrate/v4 v4.19.1
|
|
github.com/google/uuid v1.6.0
|
|
github.com/gorilla/mux v1.7.4
|
|
github.com/gorilla/websocket v1.5.3
|
|
github.com/hr3lxphr6j/requests v0.0.1
|
|
github.com/joho/godotenv v1.5.1
|
|
github.com/kira1928/remotetools v0.3.6
|
|
github.com/prometheus/client_golang v1.11.0
|
|
github.com/robertkrimen/otto v0.5.1
|
|
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b
|
|
github.com/shirou/gopsutil/v3 v3.24.5
|
|
github.com/sirupsen/logrus v1.9.3
|
|
github.com/stretchr/testify v1.11.1
|
|
github.com/tidwall/gjson v1.17.3
|
|
go.uber.org/mock v0.5.2
|
|
golang.org/x/net v0.48.0
|
|
golang.org/x/sync v0.19.0
|
|
golang.org/x/sys v0.39.0
|
|
golang.org/x/tools/gopls v0.21.0
|
|
google.golang.org/protobuf v1.36.7
|
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
|
gopkg.in/yaml.v3 v3.0.1
|
|
honnef.co/go/tools v0.7.0-0.dev.0.20251022135355-8273271481d0
|
|
modernc.org/sqlite v1.42.2
|
|
)
|
|
|
|
require github.com/blang/semver/v4 v4.0.0 // indirect
|
|
|
|
require (
|
|
github.com/BurntSushi/toml v1.5.0 // indirect
|
|
github.com/Masterminds/goutils v1.1.0 // indirect
|
|
github.com/Masterminds/semver v1.5.0 // indirect
|
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
|
|
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
|
|
github.com/beorn7/perks v1.0.1 // indirect
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/cilium/ebpf v0.11.0 // indirect
|
|
github.com/cosiner/argv v0.1.0 // indirect
|
|
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
|
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
|
github.com/derekparker/trie/v3 v3.2.0 // indirect
|
|
github.com/dlclark/regexp2 v1.11.4 // indirect
|
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
|
github.com/fatih/camelcase v1.0.0 // indirect
|
|
github.com/fatih/gomodifytags v1.17.1-0.20250423142747-f3939df9aa3c // indirect
|
|
github.com/fatih/structtag v1.2.0 // indirect
|
|
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
|
github.com/go-delve/liner v1.2.3-0.20231231155935-4726ab1d7f62 // indirect
|
|
github.com/go-ole/go-ole v1.2.6 // indirect
|
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
|
github.com/golang/protobuf v1.5.0 // indirect
|
|
github.com/google/go-cmp v0.7.0 // indirect
|
|
github.com/google/go-dap v0.12.0 // indirect
|
|
github.com/google/jsonschema-go v0.3.0 // indirect
|
|
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e // indirect
|
|
github.com/huandu/xstrings v1.3.2 // indirect
|
|
github.com/imdario/mergo v0.3.11 // indirect
|
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
|
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/mattn/go-runewidth v0.0.13 // indirect
|
|
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
|
github.com/mitchellh/copystructure v1.0.0 // indirect
|
|
github.com/mitchellh/reflectwalk v1.0.0 // indirect
|
|
github.com/modelcontextprotocol/go-sdk v0.8.0 // indirect
|
|
github.com/ncruces/go-strftime v1.0.0 // indirect
|
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
|
github.com/prometheus/client_model v0.2.0 // indirect
|
|
github.com/prometheus/common v0.26.0 // indirect
|
|
github.com/prometheus/procfs v0.6.0 // indirect
|
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
|
github.com/rivo/uniseg v0.2.0 // indirect
|
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
|
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
|
github.com/spf13/cobra v1.9.1 // indirect
|
|
github.com/spf13/pflag v1.0.6 // indirect
|
|
github.com/tidwall/match v1.1.1 // indirect
|
|
github.com/tidwall/pretty v1.2.1 // indirect
|
|
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
|
github.com/tklauser/numcpus v0.6.1 // indirect
|
|
github.com/ulikunitz/xz v0.5.15 // indirect
|
|
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
|
|
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
|
go.starlark.net v0.0.0-20231101134539-556fd59b42f6 // indirect
|
|
golang.org/x/arch v0.11.0 // indirect
|
|
golang.org/x/crypto v0.46.0 // indirect
|
|
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
|
|
golang.org/x/exp/typeparams v0.0.0-20251023183803-a4bb9ffd2546 // indirect
|
|
golang.org/x/mod v0.31.0 // indirect
|
|
golang.org/x/telemetry v0.0.0-20251203150158-8fff8a5912fc // indirect
|
|
golang.org/x/text v0.32.0 // indirect
|
|
golang.org/x/tools v0.40.0 // indirect
|
|
golang.org/x/vuln v1.1.4 // indirect
|
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
|
gopkg.in/sourcemap.v1 v1.0.5 // indirect
|
|
modernc.org/libc v1.67.4 // indirect
|
|
modernc.org/mathutil v1.7.1 // indirect
|
|
modernc.org/memory v1.11.0 // indirect
|
|
mvdan.cc/gofumpt v0.8.0 // indirect
|
|
mvdan.cc/xurls/v2 v2.6.0 // indirect
|
|
)
|