Skip to content

Commit

Permalink
Merge branch 'main' of http://github.com/sipcapture/rtcagent
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovikov committed Jun 3, 2023
2 parents 4464625 + 243316e commit 845aaf1
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 21 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: RTCAgent Builder

on:
workflow_dispatch:
release:
types: [created]


env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Setup Build Env
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com//sipcapture/rtcagent/master/builder/init_env.sh)"
- name: Build RTCAgent
run: make
- name: Compress
run: |
strip bin/rtcagent
upx bin/rtcagent
- name: Check & Run
run: |
ls -alFh bin/rtcagent
./bin/rtcagent --help
- name: Patch NFPM Version
run: |
sudo sed -i "s/0.0.0/${{ github.ref_name }}/g" rtcagent.yml
- name: Create deb package
id: nfpm-deb
uses: burningalchemist/nfpm-action@v1
env:
VERSION: ${{ github.event.release.tag_name }}
with:
packager: deb
config: rtcagent.yml
target: rtcagent_${{ github.ref_name }}_all.deb
- name: Create rpm package
id: nfpm-rpm
uses: burningalchemist/nfpm-action@v1
env:
VERSION: ${{ github.event.release.tag_name }}
with:
packager: rpm
config: rtcagent.yml
target: rtcagent_${{ github.ref_name }}.amd64.rpm

- name: Upload Release
if: github.event_name != 'pull_request'
uses: boxpositron/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_config: |
./bin/rtcagent
./rtcagent_${{ github.ref_name }}_all.deb
./rtcagent_${{ github.ref_name }}.amd64.rpm
tag_name: ${{ github.ref_name }}
release_name: rtcagent_${{ github.ref_name }}
draft: false
prerelease: false
overwrite: true

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker Build and push
uses: docker/[email protected]
with:
context: .
push: true
tags: |
ghcr.io/sipcapture/rtcagent:latest
ghcr.io/sipcapture/rtcagent:${{ github.ref_name }}
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM alpine as builder
RUN apk add --allow-untrusted --update --no-cache curl ca-certificates
WORKDIR /
RUN curl -fsSL github.com/sipcapture/rtcagent/releases/latest/download/rtcagent -O && chmod +x rtcagent

FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /rtcagent /rtcagent
CMD ["/rtcagent"]
95 changes: 75 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,52 +1,107 @@
# RtcAgent
<a href="https://github.com/sipcapture">
<img src="https://github.com/sipcapture/rtcagent/assets/1423657/e1d78a7e-cf2e-4775-9177-b0a730ba66c6" height=100>
</a>

The agent is focusing on VoIP/RTC Applications to make troubleshooting, support and monitoring much easily.
RTCagent is an HEP/eBPF powered observability tool for VoIP/WebRTC Applications.

The Project was inspired by Cilum, Odigos, eCapture. Thank you these projects for nice libraries, implementations and huge job! Without you it will be impossible!
<br>

> **Note**
>
> Supports Linux/Android kernel versions x86_64 4.18 and above, **aarch64 5.5** and above.
> Does not support Windows and macOS system.
----
### Made with eBPF
Before proceeding, learn everything you need to know about [eBPF](https://ebpf.io)

# What's eBPF
[eBPF](https://ebpf.io)
<a href="https://github.com/sipcapture">
<img src="https://github.com/sipcapture/rtcagent/assets/1423657/8a8d5057-12d0-432a-847e-80a8354825b6" height=400>
</a>

# How to compile
Linux Kernel: >= 4.18.
### Download
Download an `amd64/x86` static build of `rtcagent` and use it immediately.
```bash
curl -fsSL github.com/sipcapture/rtcagent/releases/latest/download/rtcagent -O && chmod +x rtcagent
```

Prefer using packages? Get the latest [deb and rpm](https://github.com/sipcapture/rtcagent/releases) releases for `amd64/x86`

### Usage

```
NAME: rtcagent - Capture and debug RTC Projects.
USAGE: rtcagent [flags]
COMMANDS:
freeswitch capture SIP messages from freeswitch (libsofia): t_port, su_recv
help Help about any command
kamailio capture SIP messages from kamailio: recv_msg, udp_send, tcp_send.
tcpdrop show tcp drops
DESCRIPTION:
RTCAgent is a tool that can capture and trace SIP packets using eBPF hooks and HEP
Usage:
rtcagent <command> -h
## Tools
OPTIONS:
-d, --debug[=false] enable debug logging
-h, --help[=false] help for rtcagent
-P, --hep-port="9060" hep port - default 9060
-S, --hep-server="" hep server to duplicate: i.e. 10.0.0.1
-T, --hep-transport="udp" hep transport default udp. Can be udp, tcp, tls
--hex[=false] print byte strings as hex encoded strings
-l, --log-file="" -l save the packets to file
--nosearch[=false] no lib search
-p, --pid=0 if pid is 0 then we target all pids
-u, --uid=0 if uid is 0 then we target all users
-v, --version[=false] version for rtcagent
```

<br>

### Build

> Compatible with Linux/Android kernel versions >= **x86_64 4.18**, >= **aarch64 5.5**.<br>
> Linux only. Does not support Windows and macOS.
#### Requirements
* golang 1.18 or newer
* clang 9.0 or newer
* cmake 3.18.4 or newer
* clang backend: llvm 9.0 or newer
* kernel config:CONFIG_DEBUG_INFO_BTF=y

## command
#### Instructions

### ubuntu
##### Ubuntu
If you are using Ubuntu 20.04 or later versions, you can use a single command to complete the initialization of the compilation environment.
```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com//sipcapture/rtcagent/master/builder/init_env.sh)"
```
### other Linux
In addition to the software listed in the 'Toolchain Version' section above, the following software is also required for the compilation environment. Please install it yourself.
##### Any Linux
In addition to the software listed in the 'Toolchain Version' section above, the following software is also required for the compilation environment. Please install before proceeding.

* linux-tools-common
* linux-tools-generic
* pkgconf
* libelf-dev

**Clone the repository code and compile it**
**Clone the repository code and compile**
```shell
git clone [email protected]:/sipcapture/rtcagent.git
cd rtcagent
make
bin/rtcagent
```
## compile without BTF
RtcAgent support BTF disabled with command `make nocore` to compile at 2022/04/17. It can work normally even on Linux systems that do not support BTF.
#### compile without BTF
RTCAgent support BTF disabled with command `make nocore` to compile at 2022/04/17 and can run on Linux systems that do not support BTF.
```shell
make nocore
bin/rtcagent --help
```

<br>

### Credits

RTCAgent is inspired by Cilum, Odigos, eCapture and the many eBPF guides, libraries and implementations.
2 changes: 1 addition & 1 deletion cli/cmd/freeswitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var freeswitchConfig = config.NewFreeSwitchConfig()
// freeswitchCmd represents the freeswitch command
var freeswitchCmd = &cobra.Command{
Use: "freeswitch",
Short: "capture SIP messages from freeswitch: recv_msg, udp_send, tcp_send.",
Short: "capture SIP messages from freeswitch (libsofia): t_port, su_recv.",
Long: ` Tested on freeswitch 1.x`,
Run: freeswitchCommandFunc,
}
Expand Down
19 changes: 19 additions & 0 deletions rtcagent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: rtcagent
arch: amd64
platform: linux
version: 0.0.0
release: 1
section: default
priority: extra
replaces:
- rtcagent
provides:
- rtcagent
maintainer: Alexandr Dubovikob <[email protected]>
description: RTCagent is a HEP/eBPF sniffer for VoiP/RTC Applications
vendor: sipcapture.org
homepage: http://sipcapture.org
license: AGPLv3
contents:
- src: ./bin/rtcagent
dst: /usr/bin/rtcagent

0 comments on commit 845aaf1

Please sign in to comment.