mirror of
https://github.com/cuteLittleDevil/m7s-jt1078.git
synced 2025-12-24 13:29:23 +08:00
github: 添加actions
This commit is contained in:
63
.github/workflows/mac.yml
vendored
Normal file
63
.github/workflows/mac.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: release-macos
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
build-macos: #https://github.com/softprops/action-gh-release
|
||||
name: Build on macOS
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
echo ${{ github.sha }} > Release.txt
|
||||
mkdir release
|
||||
cp Release.txt LICENSE release/
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Go Build
|
||||
run: |
|
||||
cd ./example/simulation/
|
||||
go build -o simulation || exit 1
|
||||
cd ../video
|
||||
go build -o video || exit 1
|
||||
cd ../intercom
|
||||
go build -o intercom || exit 1
|
||||
|
||||
- name: Package Files
|
||||
run: |
|
||||
cp -r ./example/testdata/ release/testdata
|
||||
cp ./example/README.md release/README.md
|
||||
mkdir -p release/simulation
|
||||
cp ./example/simulation/simulation release/simulation/
|
||||
cp ./example/simulation/config.yaml release/simulation/
|
||||
mkdir -p release/video/video
|
||||
cp ./example/video/video release/video/
|
||||
cp ./example/video/config.yaml release/video/
|
||||
cp ./example/video/curl.http release/video/
|
||||
cp -r ./example/video/static/ release/video/static
|
||||
mkdir -p release/intercom
|
||||
cp ./example/intercom/intercom release/intercom/
|
||||
cp ./example/intercom/config.yaml release/intercom/
|
||||
cp ./example/intercom/curl.http release/intercom/
|
||||
cp -r ./example/intercom/static/ release/intercom/static
|
||||
zip -r release-darwin-arm64.zip release
|
||||
|
||||
- name: Test
|
||||
run: cat Release.txt
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release-darwin-arm64.zip
|
||||
update_latest_release: true
|
||||
69
.github/workflows/ubuntu.yml
vendored
Normal file
69
.github/workflows/ubuntu.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: release-ubuntu
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
build-ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64, arm64]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
echo ${{ github.sha }} > Release.txt
|
||||
mkdir release
|
||||
cp Release.txt LICENSE release/
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Set GOARCH
|
||||
run: |
|
||||
echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Go Build
|
||||
run: |
|
||||
cd ./example/simulation/
|
||||
go build -o simulation || exit 1
|
||||
cd ../video
|
||||
go build -o video || exit 1
|
||||
cd ../intercom
|
||||
go build -o intercom || exit 1
|
||||
|
||||
- name: Package Files
|
||||
run: |
|
||||
cp -r ./example/testdata/ release/testdata
|
||||
cp ./example/README.md release/README.md
|
||||
mkdir -p release/simulation
|
||||
cp ./example/simulation/simulation release/simulation/
|
||||
cp ./example/simulation/config.yaml release/simulation/
|
||||
mkdir -p release/video/video
|
||||
cp ./example/video/video release/video/
|
||||
cp ./example/video/config.yaml release/video/
|
||||
cp ./example/video/curl.http release/video/
|
||||
cp -r ./example/video/static/ release/video/static
|
||||
mkdir -p release/intercom
|
||||
cp ./example/intercom/intercom release/intercom/
|
||||
cp ./example/intercom/config.yaml release/intercom/
|
||||
cp ./example/intercom/curl.http release/intercom/
|
||||
cp -r ./example/intercom/static/ release/intercom/static
|
||||
zip -r release-ubuntu-${{ matrix.arch }}.zip release
|
||||
|
||||
- name: Test
|
||||
run: cat Release.txt
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release-ubuntu-${{ matrix.arch }}.zip
|
||||
update_latest_release: true
|
||||
63
.github/workflows/win.yml
vendored
Normal file
63
.github/workflows/win.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: release-windows
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
build-windows: #https://github.com/softprops/action-gh-release
|
||||
name: Build on Windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
echo ${{ github.sha }} > Release.txt
|
||||
New-Item -ItemType Directory -Force -Path release
|
||||
Copy-Item Release.txt, LICENSE -Destination release
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Go Build
|
||||
run: |
|
||||
cd .\example\simulation
|
||||
go build -o simulation.exe || exit 1
|
||||
cd ..\video
|
||||
go build -o video.exe || exit 1
|
||||
cd ..\intercom
|
||||
go build -o intercom.exe || exit 1
|
||||
|
||||
- name: Package Files
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force -Path release\video
|
||||
Copy-Item -Recurse .\example\testdata\ release\testdata
|
||||
Copy-Item .\example\README.md release\README.md
|
||||
Copy-Item .\example\video\video.exe release\video\
|
||||
Copy-Item .\example\video\config.yaml release\video\
|
||||
Copy-Item .\example\video\curl.http release\video\
|
||||
Copy-Item -Recurse .\example\video\static release\video\static
|
||||
New-Item -ItemType Directory -Force -Path release\simulation
|
||||
Copy-Item .\example\simulation\simulation.exe release\simulation\
|
||||
Copy-Item .\example\simulation\config.yaml release\simulation\
|
||||
New-Item -ItemType Directory -Force -Path release\intercom
|
||||
Copy-Item .\example\intercom\intercom.exe release\intercom\
|
||||
Copy-Item .\example\intercom\config.yaml release\intercom\
|
||||
Copy-Item .\example\intercom\curl.http release\intercom\
|
||||
Copy-Item -Recurse .\example\intercom\static release\intercom\static
|
||||
Compress-Archive -Path release -DestinationPath release-windows-amd64.zip
|
||||
|
||||
- name: Test
|
||||
run: Get-Content Release.txt
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: release-windows-amd64.zip
|
||||
update_latest_release: true
|
||||
@@ -164,7 +164,7 @@ jt1078:
|
||||
audioports: [12021, 12050] # 音频端口 [min,max]
|
||||
onjoinurl: "https://127.0.0.1:12000/api/v1/jt808/event/join-audio" # 设备连接到音频端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/jt808/event/leave-audio" # 设备断开了音频端口的回调
|
||||
overtimesecond: 60 # 多久没有下发对讲语言的数据 就关闭这个链接
|
||||
overtimesecond: 60 # 多久没有下发对讲语音的数据 就关闭这个链接
|
||||
|
||||
realtime: # 实时视频
|
||||
addr: '0.0.0.0:12051'
|
||||
@@ -175,7 +175,7 @@ jt1078:
|
||||
playback: # 回放视频
|
||||
addr: '0.0.0.0:12052'
|
||||
onjoinurl: "https://127.0.0.1:12000/api/v1/play-back-join" # 设备连接到了回放视频指定端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/play-back-leave" # 设备断开到了回放视频指定端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/play-back-leave" # 设备断开了回放视频指定端口的回调
|
||||
prefix: "live/jt1079" # 默认自定义前缀-手机号-通道 如:live/jt1079-295696659617-1
|
||||
|
||||
simulations:
|
||||
|
||||
108
example/README.md
Normal file
108
example/README.md
Normal file
@@ -0,0 +1,108 @@
|
||||
<h1 id="m7s"> m7s-jt1078 </h1>
|
||||
|
||||
- [m7s官方地址](https://monibuca.com)
|
||||
|
||||
---
|
||||
|
||||
| 例子 | 测试页面 | 代码 |
|
||||
|----------|-----|-------------------|
|
||||
| 音视频 | http://124.221.30.46:11000 | [详情点击](./example/video) |
|
||||
| 对讲 | https://go-jt808.online:12000 | [详情点击](./example/intercom) |
|
||||
| 模拟流 | 视频 http://124.221.30.46:8088/preview/live/jt1078-295696659617-1?type=mp4 <br/> 音视频 http://124.221.30.46:8088/preview/live/jt1079-156987000796-1| [详情点击](./example/simulation) |
|
||||
|
||||
---
|
||||
|
||||
<h2>1. 模拟流</h2>
|
||||
|
||||
```
|
||||
启动 (win系统的话 双击exe)
|
||||
cd ./simulation && ./simulation
|
||||
"模拟实时视频流地址": "http://127.0.0.1:8080/preview/live/jt1078-295696659617-1?type=mp4"
|
||||
"模拟回放音视频流地址(音频G711A)": "http://127.0.0.7:8080/preview/live/jt1079-156987000796-1"
|
||||
```
|
||||
|
||||
<h2>2. 音视频</h2>
|
||||
|
||||
```
|
||||
启动 (win系统的话 双击exe)
|
||||
cd ./video && ./video
|
||||
默认首页 http://127.0.0.1:11000
|
||||
已经部署的在线网页 http://124.221.30.46:11000/
|
||||
```
|
||||
|
||||
- 需要设备连到jt808服务 并且下发9101指令
|
||||
- 内置的jt808服务监听的端口是11001
|
||||
|
||||
``` curl
|
||||
使用内置jt808下发9101指令如下 key是sim卡号 用自己的测试设备
|
||||
POST http://127.0.0.1:11000/api/v1/jt808/9101
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"key": "10088",
|
||||
"data": {
|
||||
"serverIPLen": 13,
|
||||
"serverIPAddr": "124.221.30.46",
|
||||
"tcpPort": 11051,
|
||||
"udpPort": 0,
|
||||
"channelNo": 1,
|
||||
"dataType": 0,
|
||||
"streamType": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
触发9101指令后 在如下地址可以看到流存在情况
|
||||
http://127.0.0.1:11080/preview/
|
||||
播放地址如 http://124.221.30.46:11080/flv/live/jt1078-10086-1.flv
|
||||
```
|
||||
|
||||
<h2>3. 对讲</h2>
|
||||
|
||||
```
|
||||
需要https 因为浏览器调用设备需要https
|
||||
启动 (win系统的话 双击exe)
|
||||
cd ./intercom && ./intercom
|
||||
默认首页 https://127.0.0.1:12000
|
||||
已经部署的在线网页 https://124.221.30.46:12000/
|
||||
```
|
||||
|
||||
详情参考 https://github.com/cuteLittleDevil/m7s-jt1078#对讲流程参考
|
||||
|
||||
<h2> 配置说明 </h2>
|
||||
|
||||
``` yaml
|
||||
jt1078:
|
||||
enable: true # 是否启用
|
||||
|
||||
intercom:
|
||||
enable: true # 是否启用 用于双向对讲
|
||||
jt1078webrtc:
|
||||
port: 12020 # 外网UDP端口 用于浏览器webrtc把音频数据推到这个端口
|
||||
ip: 124.221.30.46 # 外网ip 用于SDP协商修改
|
||||
audioports: [12021, 12050] # 音频端口 [min,max]
|
||||
onjoinurl: "https://127.0.0.1:12000/api/v1/jt808/event/join-audio" # 设备连接到音频端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/jt808/event/leave-audio" # 设备断开了音频端口的回调
|
||||
overtimesecond: 60 # 多久没有下发对讲语音的数据 就关闭这个链接
|
||||
|
||||
realtime: # 实时视频
|
||||
addr: '0.0.0.0:12051'
|
||||
onjoinurl: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-join" # 设备连接到了实时视频指定端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/jt808/event/real-time-leave" # 设备断开了实时视频指定端口的回调
|
||||
prefix: "live/jt1078" # 默认自定义前缀-手机号-通道 如:live/jt1078-295696659617-1
|
||||
|
||||
playback: # 回放视频
|
||||
addr: '0.0.0.0:12052'
|
||||
onjoinurl: "https://127.0.0.1:12000/api/v1/play-back-join" # 设备连接到了回放视频指定端口的回调
|
||||
onleaveurl: "https://127.0.0.1:12000/api/v1/play-back-leave" # 设备断开了回放视频指定端口的回调
|
||||
prefix: "live/jt1079" # 默认自定义前缀-手机号-通道 如:live/jt1079-295696659617-1
|
||||
|
||||
simulations:
|
||||
# jt1078文件 默认循环发送
|
||||
- name: ../testdata/data.txt
|
||||
addr: 127.0.0.1:12051 # 模拟实时
|
||||
- name: ../testdata/audio_data.txt
|
||||
addr: 127.0.0.1:12052 # 模拟回放
|
||||
|
||||
```
|
||||
@@ -3,7 +3,7 @@ module simulation
|
||||
go 1.23.8
|
||||
|
||||
require (
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0
|
||||
m7s.live/v5 v5.0.0
|
||||
)
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ github.com/cilium/ebpf v0.15.0 h1:7NxJhNiBT3NG8pZJ3c+yfrVdHY8ScgKD27sScgjLMMk=
|
||||
github.com/cilium/ebpf v0.15.0/go.mod h1:DHp1WyrLeiBh19Cf/tfiSMhqheEiK8fXFZ4No0P1Hso=
|
||||
github.com/cuteLittleDevil/go-jt808/protocol v1.16.0 h1:svWxOTAfKLchDp/5kwwVVhoFprLM98QJUgmYCs5ixj8=
|
||||
github.com/cuteLittleDevil/go-jt808/protocol v1.16.0/go.mod h1:5wF2o2JCjVVj/oAqkwvCzgu23UYMrnDO+PkhiS0/egs=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1 h1:qQAHfidwJyaExrOPcavfglCA4ECJ1QvqgDFWdcS+GIQ=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1/go.mod h1:cdGQVgTjZ6wgz6GgMwnux1J5dkJgTjKG2qVTcf/5WWI=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0 h1:5IVxSfFYm36d3+4h6JKZfU9u8zboAuHmchh3ALSQ7QY=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0/go.mod h1:IruDxdWBKu72A2obGE31QQaqLdBdXc/V0tBiDvn294o=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
|
||||
31
example/video/curl.http
Normal file
31
example/video/curl.http
Normal file
@@ -0,0 +1,31 @@
|
||||
### 开启实时视频 音视频
|
||||
POST http://124.221.30.46:11000/api/v1/jt808/9101
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"key": "10086",
|
||||
"data": {
|
||||
"serverIPLen": 13,
|
||||
"serverIPAddr": "124.221.30.46",
|
||||
"tcpPort": 11051,
|
||||
"udpPort": 0,
|
||||
"channelNo": 1,
|
||||
"dataType": 0,
|
||||
"streamType": 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
### 关闭实时视频
|
||||
POST http://124.221.30.46:11000/api/v1/jt808/9102
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"key": "10086",
|
||||
"data": {
|
||||
"channelNo": 1,
|
||||
"controlCmd": 0,
|
||||
"closeAudioVideoData": 0,
|
||||
"streamType": 0
|
||||
}
|
||||
}
|
||||
@@ -6,9 +6,9 @@ require (
|
||||
github.com/cuteLittleDevil/go-jt808/protocol v1.16.0
|
||||
github.com/cuteLittleDevil/go-jt808/service v1.11.0
|
||||
github.com/cuteLittleDevil/go-jt808/shared v1.6.0
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
m7s.live/v5 v5.0.0-beta20250506
|
||||
m7s.live/v5 v5.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -24,8 +24,8 @@ github.com/cuteLittleDevil/go-jt808/service v1.11.0 h1:+unxCBMitYRIpjka5FcIKSFjV
|
||||
github.com/cuteLittleDevil/go-jt808/service v1.11.0/go.mod h1:sjfTZKpMMPa3FLgFn56j5DvLATy4hJ54FbgDkE82QXw=
|
||||
github.com/cuteLittleDevil/go-jt808/shared v1.6.0 h1:aJ6a8f3AVS47p5Nja7+/kLRqhnRcv+j/7Jmd+SpnkQ4=
|
||||
github.com/cuteLittleDevil/go-jt808/shared v1.6.0/go.mod h1:BMWFmkDRLNjcXcuiPm/yphfWfZ6xNuTAJDkDDNhysOM=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1 h1:qQAHfidwJyaExrOPcavfglCA4ECJ1QvqgDFWdcS+GIQ=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.3.1/go.mod h1:cdGQVgTjZ6wgz6GgMwnux1J5dkJgTjKG2qVTcf/5WWI=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0 h1:5IVxSfFYm36d3+4h6JKZfU9u8zboAuHmchh3ALSQ7QY=
|
||||
github.com/cuteLittleDevil/m7s-jt1078/v5 v5.5.0/go.mod h1:IruDxdWBKu72A2obGE31QQaqLdBdXc/V0tBiDvn294o=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
@@ -360,6 +360,6 @@ gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkw
|
||||
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
|
||||
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
|
||||
m7s.live/v5 v5.0.0-beta20250506 h1:P86hD7MkQQwsiMEo6d/pL3p31ncXWbUDmv//rauOxKk=
|
||||
m7s.live/v5 v5.0.0-beta20250506/go.mod h1:bhha1YjHhBIhqRsGFTW2prbTxM6P4j0pKBpKz9nTeko=
|
||||
m7s.live/v5 v5.0.0 h1:wAP5MkNlxEdv/LtEXm9I4UG8ue08DfPHfsc6jNOWMuk=
|
||||
m7s.live/v5 v5.0.0/go.mod h1:bhha1YjHhBIhqRsGFTW2prbTxM6P4j0pKBpKz9nTeko=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
|
||||
Reference in New Issue
Block a user