Bridge all webhook with a universal message center
  • Go 91.8%
  • Shell 4.5%
  • Dockerfile 3.7%
Find a file
2026-09-06 19:39:08 +08:00
.github/workflows forward ws message & update deploy script 2024-07-16 22:03:29 +08:00
router fix array len 2024-10-07 14:33:55 +08:00
service organize files 2024-07-16 22:12:04 +08:00
util organize files 2024-07-16 22:12:04 +08:00
.gitignore rename project 2024-07-14 21:55:18 +08:00
docker_build.sh rename project 2024-07-14 21:55:18 +08:00
docker_test.sh rename project 2024-07-14 21:55:18 +08:00
Dockerfile rename project 2024-07-14 21:55:18 +08:00
go.mod deps: update dependency 2025-04-27 11:55:40 +08:00
go.sum deps: update dependency 2025-04-27 11:55:40 +08:00
LICENSE Initial commit 2023-11-18 16:06:48 +08:00
main.go organize files 2024-07-16 22:12:04 +08:00
README.md Archive 2026-09-06 19:39:08 +08:00

notification-center

职能已迁移到 https://github.com/nbtca/ServerlessMQ

消息事件转发中心

  • 在配置的端口监听 http(s)请求,用于接收 http(webhook) 请求
  • 在配置的端口/ws 路径下监听 websocket 请求,连接到此 websocket 的客户端会收到转发自 http(webhook) 的请求消息

🚀 Deployment/部署

  • 🐳 Docker

    执行docker_build.sh,将构建并打包webhook.tar镜像文件,在运行环境执行docker load -i webhook.tar导入镜像

    • 启动命令(参考)
      touch notification-center.config.json
      docker run -d -p 8080:8080 --name webhook -v $(pwd)/notification-center.config.json:/config/config.json webhook
      

🛠️ Config/配置

{
  "bind": ":8080",
  "use_cert": false,
  "cert_file": "fullchain.cer",
  "key_file": "private.key",
  "auth": {
    "": "默认路径的密钥",
    "github": "对于/github路径的请求使用的密钥"
  }
}

🛡️ Authentication/鉴权

不论是 http(s) 还是 websocket 请求,都需要进行鉴权,鉴权方式如下二选一

  • Header["Authorization"]

    • 用于直接鉴权的密钥
    • 格式为Bearer ${value}${value}为配置文件中auth字段中的value对应的值
  • Header["X-Signature-256"]

    • SHA256签名,用于验证请求的合法性,通过auth字段中的value作为 HMAC 的密钥,对请求的body进行签名,签名结果与请求头中的X-Signature-256进行比对,如果一致则请求合法,否则请求非法

🎉 Sample/示例

client A 负责推送事件使用POST请求发送到 service_1路径下(POST https://xxx.xxx/service_1)client B 通过 websocket 连接到 (POST wss://xxx.xxx/ws/service_1),此时client B 将收到 client A 推送的事件。