Cloudflare和阿里云DDNS的Shell实现

下一步开发计划 接入Telegram机器人,IP变化时自动通知 脚本地址 raw.githubusercontent.com/laningya/Raspberry-Pi/refs/heads/master/shell/cfddns.sh raw.githubusercontent.com/laningya/Raspberry-Pi/refs/heads/master/shell/aliddns.sh 使用说明 Cloudflare proxy=false/true,是否开始Cloudflare小黄云选项 ZONE_ID,API_TOKEN,Cloudflare 域ID和API令牌,API需对应域名的DNS编辑和读取权限 IPv4Domain,需要填写全写,如"test.yourdomain.com" 阿里云 accessKeyId,accessSecret,需要在阿里云控制台获取,并赋予DNS编辑和读取权限 与Cloudflare不同,子域名和主域名分开

February 6, 2025 · 1 min · laning

使用 Telegram 作为存储后端的图床程序

项目地址 GitHub - nodeseeker/goImage: 基于 Go 开发的图片托管服务,使用 Telegram 作为存储后端。 GitHub - laningya/goImage: 基于 Go 开发的图片托管服务,使用 Telegram 作为存储后端。 部署流程 拉取Dockerfile并本地构建镜像 wget https://raw.githubusercontent.com/laningya/goImage/refs/heads/main/Dockerfile docker build -t image . 拉取docker-compose.yml文件 wget https://raw.githubusercontent.com/laningya/goImage/refs/heads/main/docker-compose.yml 拉取config.json文件 wget https://raw.githubusercontent.com/laningya/goImage/refs/heads/main/config.json config.json文件说明如下: { "telegram": { "token": "1234567890:ABCDEFG_ab1-asdfghjkl12345", "chatId": -123456789 }, "admin": { "username": "nodeseeker", "password": "nodeseeker@123456" }, "site": { "name": "NodeSeek", "maxFileSize": 10, "port": 18080, "host": "127.0.0.1" } } telegram.token:电报机器人的Bot Token telegram.chatId:频道的Chat ID admin.username:网站管理员用户名 admin.password:网站管理员密码 site.name:网站名称 site.maxFileSize:最大上传文件大小(单位:MB),建议10MB site.port:服务端口,默认18080 site.host:服务监听地址,默认127.0.0.0本地监听;如果需要调试或外网访问,可修改为0.0.0.0 以上参数获取方式: ...

December 4, 2024 · 1 min · laning

基于Cloudflare Worker的Telegram传信机器人

项目原因 Telegram是很注重隐私的聊天软件,受到很多人的青睐。但是,如果经常和陌生人聊天很容易触发风控,因此一款好用的传信机器人十分有必要。 项目特色 在nfdv1项目的基础上增加提示对方ID(TG账户唯一标识) 美化输出UI,以及封禁逻辑 支持构建欺诈数据库,有不良记录的用户及时提醒 部署方法 从@BotFather获取token,并且可以发送/setjoingroups来禁止此Bot被添加到群组 从uuidgenerator获取一个随机uuid作为secret 从@username_to_id_bot获取你的用户id 登录cloudflare,创建一个worker 配置worker的变量 增加一个ENV_BOT_TOKEN变量,数值为从步骤1中获得的token 增加一个ENV_BOT_SECRET变量,数值为从步骤2中获得的secret 增加一个ENV_ADMIN_UID变量,数值为从步骤3中获得的用户id 绑定kv数据库,创建一个Namespace Name为nfd的kv数据库,在setting -> variable中设置KV Namespace Bindings:nfd -> nfd 点击Quick Edit,复制这个文件到编辑器中 通过打开https://xxx.workers.dev/registerWebhook来注册websoket 使用方法 当其他用户给bot发消息,会被转发到bot创建者 用户回复普通文字给转发的消息时,会回复到原消息发送者 用户回复/block, /unblock, /checkblock等命令会执行相关指令,不会回复到原消息发送者

September 5, 2024 · 1 min · laning

服务备份与同步脚本实现

脚本地址 raw.githubusercontent.com/laningya/Raspberry-Pi/refs/heads/master/shell/back.sh raw.githubusercontent.com/laningya/Raspberry-Pi/refs/heads/master/shell/rsync.sh 使用说明 为防止服务器宕机开发,需要配合crontab等服务实现定时备份 针对采用docker-compose部署的服务编写,如为其他方式部署的服务,此脚本并不使用

August 6, 2024 · 1 min · laning

Armbian/build脚本分析

1. 脚本目录检测和代码健壮性保证 1.1 程序报错退出脚本 #set -o pipefail # trace ERR through pipes - will be enabled "soon" #set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled set -e set -o errtrace # trace ERR through - enabled set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled # Important, go read http://mywiki.wooledge.org/BashFAQ/105 NOW! 1.2. ./compile.sh脚本目录检测 SRC="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" cd "${SRC}" || exit # check for whitespace in ${SRC} and exit for safety reasons grep -q "[[:space:]]" <<< "${SRC}" && { echo "\"${SRC}\" contains whitespace. Not supported. Aborting." >&2 exit 1 } 2. single.sh 文件加载(位于./lib) 2.1 检查bash版本是否高于5.x # The Armbian functions require Bash 5.x. if [[ "${BASH_VERSINFO:-0}" -lt 5 ]]; then echo "Armbian build scripts require Bash 5.x. Go get it..." >&2 if [[ "${OSTYPE}" == "darwin"* ]]; then echo "Armbian build scripts require brew to be installed and working on macOS. (old Bash version)" >&2 echo "Please install brew, *restart your terminal*." >&2 echo "Then run 'brew install bash coreutils git', *restart your terminal* and then try again." >&2 exit 51 fi exit 50 fi 2.2 macOS系统检查 是否以root运行脚本 Homebrew 包管理器已安装并正常工作 通过 Homebrew 的 coreutils 安装的 realpath 命令是否可用 更新 PATH 环境变量以包含由 Homebrew 安装的 GNU coreutils 二进制文件。 确保 ${SRC} 变量(应指向构建脚本的源目录)位于用户的主目录中。这对于 macOS 上的 Docker 兼容性很重要。 ...

June 6, 2024 · 10 min · laning

玩客云刷Openwrt/Armbian

玩客云配置 SOC为晶晨S805,ARM 4核1.5GHz,1G(DDR3)+8G(eMMC),两个USB 2.0,HDMI接口,一个千兆网口(RJ45 ),一个SD卡槽。 刷机工具下载 百度网盘 请输入提取码 (baidu.com) 更新 2024.04.15 OPENWRT高内核直刷 玩客云ws1608/赚钱宝三代和赚钱宝2代WS1508-PCDN、玩客云、京东云等各种云设备-恩山无线论坛 (right.com.cn) GitHub - hzyitc/armbian-onecloud: Armbian for onecloud. 玩客云用armbian 刷入Openwrt/Armbian 打开USB_Burning_Tool软件 短接触点上电,进入刷机模式 刷写系统到emmc 参考文档 玩客云刷软路由保姆教程 - 流云1 - 博客园 (cnblogs.com)

June 1, 2024 · 1 min · laning

sing-box TUN模式透明代理

前言 你的软路由到底是用来做旁路由还是主路由?如果是旁路由的话,只用科学上网不妨试试Linux旁路由网关 docker镜像构建 原本是64位的处理器,可惜之前装的32位操作系统,所以只能从Dockerfile自己构建喽 拉源码 git clone https://github.com/SagerNet/sing-box.git 构建镜像 docker build --no-cache -t laningya/sing-box:v1 . docker-compose.yml文件 version: "3.3" services: sing-box: image: laningya/sing-box:v1 container_name: sing-box restart: always network_mode: "host" volumes: - ./conf:/etc/sing-box/ devices: - /dev/net/tun:/dev/net/tun cap_add: - ALL command: -D /var/lib/sing-box -C /etc/sing-box/ run 要开启tun模式,devices和cap_add字段非常重要 一个不错的sing-box配置模板 { "dns": { "servers": [ { "tag": "dns_proxy", "address": "https://1.1.1.1/dns-query", "address_resolver": "dns_resolver", "strategy": "ipv4_only", "detour": "select" }, { "tag": "dns_direct", "address": "h3://dns.alidns.com/dns-query", "address_resolver": "dns_resolver", "strategy": "ipv4_only", "detour": "direct" }, { "tag": "dns_block", "address": "rcode://refused" }, { "tag": "dns_resolver", "address": "223.5.5.5", "strategy": "ipv4_only", "detour": "direct" } ], "rules": [ { "outbound": "any", "server": "dns_resolver" }, { "clash_mode": "direct", "server": "dns_direct" }, { "clash_mode": "global", "server": "dns_proxy" }, { "process_name": [ "TencentMeeting", "NemoDesktop", "ToDesk", "ToDesk_Service", "WeChat", "Tailscale", "wireguard-go", "Tunnelblick", "softwareupdated", "kubectl" ], "server": "dns_direct" }, { "domain_suffix": [ "icloudnative.io", "fuckcloudnative.io", "sealos.io", "cdn.jsdelivr.net" ], "server": "dns_direct" }, { "process_name": [ "DropboxMacUpdate", "Dropbox" ], "server": "dns_proxy" }, { "package_name": [ "com.google.android.youtube", "com.android.vending", "org.telegram.messenger", "org.telegram.plus" ], "server": "dns_proxy" }, { "rule_set": "geosite-geolocation-!cn", "server": "dns_proxy" }, { "rule_set": "Global", "server": "dns_proxy" }, { "rule_set": [ "YouTube", "Telegram", "Netflix", "geoip-google", "geoip-telegram", "geoip-twitter", "geoip-netflix" ], "server": "dns_proxy" } ], "final": "dns_direct" }, "ntp": { "enabled": true, "server": "time.apple.com", "server_port": 123, "interval": "30m0s", "detour": "direct" }, "inbounds": [ { "type": "tun", "inet4_address": "198.18.0.1/16", "auto_route": true, "exclude_package": [ "cmb.pb", "cn.gov.pbc.dcep", "com.MobileTicket", "com.adguard.android", "com.ainemo.dragoon", "com.alibaba.android.rimet", "com.alicloud.databox", "com.amazing.cloudisk.tv", "com.autonavi.minimap", "com.bilibili.app.in", "com.bishua666.luxxx1", "com.cainiao.wireless", "com.chebada", "com.chinamworld.main", "com.cmbchina.ccd.pluto.cmbActivity", "com.coolapk.market", "com.ctrip.ct", "com.dianping.v1", "com.douban.frodo", "com.eg.android.AlipayGphone", "com.farplace.qingzhuo", "com.hanweb.android.zhejiang.activity", "com.leoao.fitness", "com.lucinhu.bili_you", "com.mikrotik.android.tikapp", "com.moji.mjweather", "com.motorola.cn.calendar", "com.motorola.cn.lrhealth", "com.netease.cloudmusic", "com.sankuai.meituan", "com.sina.weibo", "com.smartisan.notes", "com.sohu.inputmethod.sogou.moto", "com.sonelli.juicessh", "com.ss.android.article.news", "com.ss.android.lark", "com.ss.android.ugc.aweme", "com.tailscale.ipn", "com.taobao.idlefish", "com.taobao.taobao", "com.tencent.mm", "com.tencent.mp", "com.tencent.soter.soterserver", "com.tencent.wemeet.app", "com.tencent.weread", "com.tencent.wework", "com.ttxapps.wifiadb", "com.unionpay", "com.unnoo.quan", "com.wireguard.android", "com.xingin.xhs", "com.xunmeng.pinduoduo", "com.zui.zhealthy", "ctrip.android.view", "io.kubenav.kubenav", "org.geekbang.geekTime", "tv.danmaku.bili" ], "stack": "mixed", "sniff": true }, { "type": "socks", "tag": "socks-in", "listen": "::", "listen_port": 5353 } ], "outbounds": [ { "type": "selector", "tag": "select", "outbounds": [ "trojan-out" ], "default": "trojan-out" }, { "type": "selector", "tag": "openai", "outbounds": [ "trojan-out" ], "default": "trojan-out" }, { "type": "selector", "tag": "tiktok", "outbounds": [ "trojan-out" ], "default": "trojan-out" }, { "type": "trojan", "tag": "trojan-out", "server": "199.180.115.155", "server_port": 9443, "password": "5iFHKMrn9Ez//VKh6zChTA==", "tls": { "enabled": true, "server_name": "ss.icloudnative.io", "insecure": true, "utls": { "fingerprint": "chrome" } }, "multiplex": { "protocol": "h2mux", "max_connections": 4, "min_streams": 4 }, "transport": { "type": "grpc", "service_name": "TunService" } }, { "type": "direct", "tag": "direct" }, { "type": "block", "tag": "block" }, { "type": "dns", "tag": "dns-out" } ], "route": { "rules": [ { "protocol": "dns", "outbound": "dns-out" }, { "clash_mode": "direct", "outbound": "direct" }, { "clash_mode": "global", "outbound": "select" }, { "domain_suffix": [ "icloudnative.io", "fuckcloudnative.io", "sealos.io", "cdn.jsdelivr.net" ], "outbound": "direct" }, { "process_name": [ "TencentMeeting", "NemoDesktop", "ToDesk", "ToDesk_Service", "WeChat", "OpenLens", "Tailscale", "wireguard-go", "Tunnelblick", "softwareupdated", "kubectl" ], "outbound": "direct" }, { "protocol": "quic", "outbound": "block" }, { "inbound": "socks-in", "outbound": "select" }, { "rule_set": [ "WeChat", "Bilibili" ], "outbound": "direct" }, { "rule_set": "OpenAI", "outbound": "openai" }, { "domain_suffix": [ "openai.com", "oaistatic.com", "oaiusercontent.com" ], "outbound": "openai" }, { "package_name": "com.openai.chatgpt", "outbound": "openai" }, { "rule_set": "TikTok", "outbound": "tiktok" }, { "package_name": "com.zhiliaoapp.musically", "outbound": "tiktok" }, { "domain_suffix": [ "depay.one", "orbstack.dev" ], "outbound": "select" }, { "process_name": [ "DropboxMacUpdate", "Dropbox" ], "outbound": "select" }, { "package_name": [ "com.google.android.youtube", "com.android.vending", "org.telegram.messenger", "org.telegram.plus", "com.google.android.googlequicksearchbox", "app.rvx.android.youtube", "com.mudvod.video", "com.fox2code.mmm", "com.twitter.android" ], "outbound": "select" }, { "domain": "accounts.google.com", "domain_suffix": [ "sourceforge.net", "fhjasokiwq.com" ], "outbound": "select" }, { "domain_suffix": "cloud.sealos.io", "outbound": "direct" }, { "type": "logical", "mode": "and", "rules": [ { "rule_set": "geosite-geolocation-!cn" }, { "rule_set": "geoip-cn", "invert": true } ], "outbound": "select" }, { "rule_set": "Global", "outbound": "select" }, { "rule_set": "geoip-cn", "outbound": "direct" }, { "ip_is_private": true, "outbound": "direct" }, { "rule_set": [ "YouTube", "Telegram", "Netflix", "geoip-google", "geoip-telegram", "geoip-twitter", "geoip-netflix" ], "outbound": "select" } ], "rule_set": [ { "type": "remote", "tag": "geosite-geolocation-!cn", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-!cn.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-cn", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/CHIZI-0618/v2ray-rules-dat/release/singbox_ip_rule_set/geoip-cn.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-google", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/CHIZI-0618/v2ray-rules-dat/release/singbox_ip_rule_set/geoip-google.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-telegram", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/CHIZI-0618/v2ray-rules-dat/release/singbox_ip_rule_set/geoip-telegram.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-twitter", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/CHIZI-0618/v2ray-rules-dat/release/singbox_ip_rule_set/geoip-twitter.srs", "download_detour": "direct" }, { "type": "remote", "tag": "geoip-netflix", "format": "binary", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/CHIZI-0618/v2ray-rules-dat/release/singbox_ip_rule_set/geoip-netflix.srs", "download_detour": "direct" }, { "type": "remote", "tag": "Global", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/Global.json", "download_detour": "direct" }, { "type": "remote", "tag": "YouTube", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/YouTube.json", "download_detour": "direct" }, { "type": "remote", "tag": "OpenAI", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/OpenAI.json", "download_detour": "direct" }, { "type": "remote", "tag": "TikTok", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/TikTok.json", "download_detour": "direct" }, { "type": "remote", "tag": "Telegram", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/Telegram.json", "download_detour": "direct" }, { "type": "remote", "tag": "Netflix", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/Netflix.json", "download_detour": "direct" }, { "type": "remote", "tag": "WeChat", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/WeChat.json", "download_detour": "direct" }, { "type": "remote", "tag": "Bilibili", "format": "source", "url": "https://mirror.ghproxy.com/https://raw.githubusercontent.com/yangchuansheng/sing-box-geosite/main/rule/Bilibili.json", "download_detour": "direct" } ], "final": "direct", "find_process": true, "auto_detect_interface": true }, "experimental": { "cache_file": { "enabled": true }, "clash_api": { "external_controller": "0.0.0.0:9090", "external_ui": "metacubexd", "external_ui_download_url": "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip", "external_ui_download_detour": "select", "default_mode": "rule" } } } 开启内核转发并关闭防火墙 echo 1 > /proc/sys/net/ipv4/ip_forward ufw disable 参考地址 icloudnative.io ...

April 27, 2024 · 4 min · laning

甲骨文防火墙设置

前言 甲骨文啊,你真狗!甲骨文除了与其他云厂商一样有防火墙面板,额外在系统镜像上也默认配置了防火墙,这直接导致开机更换ssh端口从而机器失联。。。 面板防火墙设置 不多说,与其他云厂商没有多大区别 系统镜像关闭防火墙 开放所有端口(Ubuntu、Debian) iptables -P INPUT ACCEPT iptables -P FORWARD ACCEPT iptables -P OUTPUT ACCEPT iptables -F 关闭防火墙 apt-get purge netfilter-persistent && reboot 参考文章 Oracle开放全部端口并关闭防火墙 - 清~幽殇 (isedu.top)

April 26, 2024 · 1 min · laning

哪吒监控部署

演示站点 laning’s dashboard 项目起因 手上的vps逐渐多了起来,还是可以玩一下监控面板 主要特性 cloudflare CDN + caddy反代 部署过程 官方参考文档 文档地址 哪吒监控 | 哪吒监控 (nezha.wiki) 主要步骤 参考文档拉取源码并docker部署,接入github作为管理账号,配置cf的cdn代理 docker部署caddy反代 docker-compose.yml version: '3.3' services: caddy: image: caddy container_name: caddy hostname: caddy restart: always volumes: - ./caddy/Caddyfile:/etc/caddy/Caddyfile - ./caddy/data:/data - ./caddy/config:/config network_mode: host Caddyfile cdn.example.com encode gzip reverse_proxy 127.0.0.1:8008 ICMP/TCP 公用IP探针 文档地址 【存】全国 34 省份 TCPING v4 IP (nodeseek.com) NTrace-V1/fast_trace/basic.go at main · nxtrace/NTrace-V1 (github.com) 故障通知机器人配置 文档地址 哪吒监控 | 哪吒监控 (nezha.wiki)

April 22, 2024 · 1 min · laning

VPS测试脚本

三网回程测试脚本 脚本地址 zhanghanyun/backtrace: 三网回程路由测试 (github.com) 命令行 curl https://raw.githubusercontent.com/zhanghanyun/backtrace/main/install.sh -sSf | sh 流媒体/GPT解锁测试脚本 脚本地址 lmc999/RegionRestrictionCheck: A bash script to check the status of your IP on various geo-restricted services. (github.com) 命令行 bash <(curl -L -s check.unlock.media) BBR加速 脚本地址 Chikage0o0/Linux-NetSpeed: 将Linux现常用的网络加速集成在一起 (github.com) 命令行 wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh 缝合怪 脚本地址 ecs/README.md at main · spiritLHLS/ecs (github.com) 命令行 curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh XrayCLI安装脚本 脚本地址 Xray一键安装脚本 · 233boy/Xray Wiki (github.com) ...

April 14, 2024 · 2 min · laning