1
0
mirror of https://github.com/fumiama/go-nd-portal.git synced 2026-06-05 00:10:25 +08:00
chasey-dev f2459dd8d9 refactor: auto get client ip from challenge response (#5)
* refactor: auto get client ip from challenge response
Since `outip()` was not working properly on devices getting local IP addresses behind a router, we should refactor this.
After analyzing the auth process, it is shown that  the challenge response includes key `client_ip` which is the real public IP address with key `ip` not specified in request.
- removed `outip()`
- added rsp key `ClientIP` to get client ip from challenge rsp

* style: trim code

* style: fix spelling issues

* refactor: create `portal_test.go` to handle portal tests separately

* feature: add `ResolveLocalClientIP()` and its test case

* optimize: resolve ClientIP locally when cant be get from challenge response
2025-09-01 22:33:57 +08:00
2025-05-17 16:27:32 +09:00
2022-11-25 19:33:53 +08:00
2025-05-17 16:24:03 +09:00
2025-05-18 21:03:34 +09:00
2025-05-18 21:03:34 +09:00
2022-11-25 19:33:53 +08:00
2025-05-17 16:36:08 +09:00

go-nd-portal

Go 你电 portal

安装

你可以下载 已经编译好的二进制文件.

从源码安装:

$ go install github.com/fumiama/go-nd-portal@latest

使用方法

也可不带参数运行,会在启动时询问参数

./go-nd-portal -n 20xxxxxxxxxxx -p password [-t <TYPE>]

默认值:

  • -ip: 本机公网出口,可自定义

  • -t: 登录类型(qsh-edu),可指定为:

    • 清水河,教学办公区:
      • qsh-edu, 教育网
      • qsh-dx, 电信
    • 清水河,新建宿舍区:
      • qshd-dx, 电信
      • qshd-cmcc, 移动
  • -s: 服务器地址(根据上述登录类型自动选择),可自定义

效果

screenshot
Languages
Go 100%