All Projects → Mmx233 → BitSrunLoginGo

Mmx233 / BitSrunLoginGo

Licence: AGPL-3.0 license
深澜校园网登录程序 Go 语言版,适用于路由器、windows、linux 等。提供对 OpenWrt、Docker、Go Module 的支持

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to BitSrunLoginGo

cloudflare-ddns-updater
Dynamic DNS (DDNS) service based on Cloudflare! Access your home network remotely via a custom domain name without a static IP! Written in pure BASH~
Stars: ✭ 434 (+287.5%)
Mutual labels:  ddns
Dnspython
a powerful DNS toolkit for python
Stars: ✭ 1,838 (+1541.07%)
Mutual labels:  ddns
vertx-ddns
基于 Vert.x 的 DDNS 解决方案。自动更新域名解析到本机IP, 支持的DNS服务商: Alidns(阿里云) 、 Dnspod(腾讯云) 、Cloudflare、华为云
Stars: ✭ 126 (+12.5%)
Mutual labels:  ddns
DnsTube
Access your computer from anywhere. DnsTube is a Windows .NET dynamic DNS client for Cloudflare.
Stars: ✭ 137 (+22.32%)
Mutual labels:  ddns
route53-dynamic-dns
Update AWS Route53 hosted zone with current public IP address. Alternative to Dynamic DNS services such as Dyn, No-IP, etc
Stars: ✭ 29 (-74.11%)
Mutual labels:  ddns
cloudflareddns
DDNS with Cloudflare
Stars: ✭ 33 (-70.54%)
Mutual labels:  ddns
AliDDNSNet
使用 C# + .NET Core 开发的开源 DDNS 工具,基于阿里云的 DNS API 接口。
Stars: ✭ 88 (-21.43%)
Mutual labels:  ddns
kmm-production-sample
This is an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile. It's a simple RSS reader, and you can download it from the App Store and Google Play. It's been designed to demonstrate how KMM can be used in real production projects.
Stars: ✭ 1,476 (+1217.86%)
Mutual labels:  multiplatform
docker-ddns-cloudflare
Cloudflare DDNS Script
Stars: ✭ 21 (-81.25%)
Mutual labels:  ddns
ddns
No description or website provided.
Stars: ✭ 26 (-76.79%)
Mutual labels:  ddns
aliyun-ddns
[Go] Update Aliyun DDNS record from OpenWRT or CLI. 阿里云域名动态解析客户端, 万网, 云解析, Windows, Linux
Stars: ✭ 17 (-84.82%)
Mutual labels:  ddns
ipns-link
Expose local http-server (web-app) through IPNS
Stars: ✭ 18 (-83.93%)
Mutual labels:  ddns
tag-push-action
Github action to copy/retag multiarch images from one registry to another
Stars: ✭ 23 (-79.46%)
Mutual labels:  multiplatform
brook
Brook 端口转发 一键管理脚本修改版 增加了对动态域名的支持 基于逗比版本修改而来
Stars: ✭ 113 (+0.89%)
Mutual labels:  ddns
kighlighter
Simple and extendable code highlighter in Kotlin Multiplatform
Stars: ✭ 22 (-80.36%)
Mutual labels:  multiplatform
aliddns
阿里云动态DNS解析。
Stars: ✭ 17 (-84.82%)
Mutual labels:  ddns
Ddns
🚩 自动更新域名解析到本机IP(支持dnspod,阿里DNS,CloudFlare,华为云,DNSCOM...)
Stars: ✭ 2,582 (+2205.36%)
Mutual labels:  ddns
cloudflare-ddns
A script to update your Cloudflare DNS records at a glance.
Stars: ✭ 152 (+35.71%)
Mutual labels:  ddns
sliding-puzzle
Sliding puzzle game implemented in Scala / Scala.js / JavaFX
Stars: ✭ 25 (-77.68%)
Mutual labels:  multiplatform
NueXini Packages
Packages for OpenWrt【每日更新luci-app OpenWrt Packages】
Stars: ✭ 269 (+140.18%)
Mutual labels:  openwrt-package

BitSrunLoginGo

Lisense Release GoReport

深澜校园网登录脚本 Go 语言版。GO 语言可以直接交叉编译出 mips 架构可执行程序(路由器)(主流平台更不用说了),从而免除安装环境。

主要登录逻辑来自: https://github.com/coffeehat/BIT-srun-login-script

OpenWrt 特供插件: Mmx233/BitSrunLoginGo_Openwrt ,压缩了 binary 文件,节省闪存空间

⚙️运行

编译结果为可执行文件,下载 release 或编译后直接启动即可

可以通过添加启动参数 --config 指定配置文件路径,默认为当前目录的 Config.yaml

支持 jsonyamlymltomlhcltfvars 等,仅对 jsonyaml 进行了优化与测试

./autoLogin --config=/demo/i.json

首次运行将自动生成配置文件,首次使用建议开启调试日志(settings.log.debug_level

Config.yaml 说明:

form:
  domain: www.msftconnecttest.com #登录地址 ip 或域名
  username: "" #账号
  usertype: cmcc #运营商类型,详情看下方
  password: "" #密码
meta: #登录参数
  "n": "200"
  type: "1"
  acid: "5"
  enc: srun_bx1
settings:
  basic: #基础设置
    https: false #访问校园网 API 时使用 https 协议
    skip_cert_verify: false #跳过证书有效校验
    timeout: 5 #网络请求超时时间(秒,正整数)
    interfaces: "" #网卡名称正则(注意转义),如:eth0\.[2-3],不为空时为多网卡模式
    use_dhcp_ip: false #多网卡模式下使用网卡 ip 认证
  guardian: #守护模式(后台常驻)
    enable: false 
    duration: 300 #网络检查周期(秒,正整数)
  daemon: #后台挂起(不建议 windows 使用,windows 请使用系统计划任务)
    enable: false
    path: .BitSrun #守护监听文件路径,用于确保只有单守护运行
  log:
    debug_level: false #打印调试日志
    write_file: false #写日志文件
    log_path: ./ #日志文件存放目录路径
    log_name: "" #指定日志文件名
  ddns: # 校园网内网 ip ddns
    enable: false
    domain: www.example.com
    ttl: 600
    provider: "cloudflare" # dns provider 配置见 DDNS 说明
    #zone: "xxxx"
    #token: "xxxx"

登录参数从原网页登陆时对 /srun_portal 的请求抓取,抓取时请把浏览器控制台的 preserve log(保留日志)启用。

运营商类型在原网页会被自动附加在账号后,请把 @ 后面的部分填入 user_type,没有则留空(删掉默认的)

🏹 DDNS

ddns.enable 设为 true 后,将在登录成功时以及守护模式下首次启动已在线时设置指定域名的解析地址(ipv4,A 记录)

支持的 Provider 及其设置(将额外配置添加到配置文件 DDNS 配置内):

Provider 额外配置项
aliyun access_key_id
access_key_secret
cloudflare zone 区域 ID
token API 令牌
dnspod secret_id
secret_key

需要注意的是,应该避免在多网卡模式下使用 ddns,如有需要,可以每个网卡创建一个配置文件单独进行登录

Docker / Kubernetes

镜像:mmx233/bitsrunlogin-go:latest

支持 linux/amd64、linux/386、linux/arm64、linux/arm/v7 架构(windows 的 WSL2 版 docker 也算 Linux)

直接使用:

配置文件挂载至 /data/Config.yaml,若需更改配置文件类型,可以使用 --entrypoint 覆写启动参数

docker run -v path_to_config:/data/Config.yaml mmx233/bitsrunlogin-go:latest

自行构建:

如果需要在其他系统或架构使用,可能需要更改构建层与底层镜像,目前使用的 alpine 并不支持 linux 之外的系统

git clone https://github.com/Mmx233/BitSrunLoginGo.git
cd BitSrunLoginGo
docker build . --file Dockerfile --tag mmx233/bitsrunlogin-go:latest

🛠️构建

请安装最新版 golang

直接编译本系统可执行程序:

git clone https://github.com/Mmx233/BitSrunLoginGo.git
cd BitSrunLoginGo
go build

或者使用经过优化的构建命令:

go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'"

交叉编译(Linux):

export GOGGC=0
export GOOS=windows #系统
export GOARCH=amd64 #架构
go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'"

交叉编译(Powershell):

$env:GOGGC=0
$env:GOOS='linux' #系统
$env:GOARCH='amd64' #架构
go build -gcflags=-trimpath=$GOPATH -asmflags=-trimpath=$GOPATH -ldflags "-s -w -extldflags '-static'"

golang 支持的系统与架构请自行查询

🧩 作为 module 使用

*本项目使用了 AGPL V3 许可证,请酌情引用

示例:

package main

import (
	"github.com/Mmx233/BitSrunLoginGo/v1"
)

func main() {
    //具体用法请查看struct注释
    conf:=&BitSrun.Conf{
        Https:  false,
        Client: nil,
        LoginInfo: BitSrun.LoginInfo{
            Form: &BitSrun.LoginForm{
                Domain:   "",
                UserName: "",
                UserType: "",
                PassWord: "",
            },
            Meta: &BitSrun.LoginMeta{
                N:    "",
                Type: "",
                Acid: "",
                Enc:  "",
            },
        },
    }

    online, clientIP, e := BitSrun.LoginStatus(conf)
    if e!=nil {
        panic(e)
    }
	
    if !online {
        e=BitSrun.DoLogin(clientIP, conf)
        if e!=nil {
            panic(e)
        }	
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].