Skip to content

Instantly share code, notes, and snippets.

View winlinvip's full-sized avatar

Winlin winlinvip

View GitHub Profile
@winlinvip
winlinvip / otel-dissector.lua
Last active September 5, 2022 14:52
Wireshark dissector for parsing Protobuf for APM over HTTP1
-- To apply this wireshark plugin:
-- mkdir -p ~/.local/lib/wireshark/plugins
-- ln -sf $(pwd)/otel.lua ~/.local/lib/wireshark/plugins/otel.lua
-- Download proto files for otel:
-- git clone https://github.com/open-telemetry/opentelemetry-proto.git
-- Setup Wireshark `Protobuf search paths` to load the proto files at `Preferences > Protocols > Protobuf`:
-- ~/git/opentelemetry-proto
-- ~/git/srs/trunk/research/proto
-- Start capture or parsing file.

Load Balancing Streaming Servers

Written by Winlin, azusachino, gforce07

When our business workload exceeds streaming server capacity, we must balance workload. Normally, the problem can be solved by clustering. Clustering is not the only way to solve the problem, though. Sometimes the concept of Load Balance can be linked to many emerging terms such as Service Discovery, but LoadBalancer on cloud service is an indispensable requirement for solving the problem. In short, this problem is very complicated, and many people ask me about this on multiple occasions. Here I’m going to systematically discuss the issue.

If you already have the answers to the questions below and understand mechanisms behind the matters, you may skip this article:

  • Does SRS need NGINX, F5 or HAProxy as stream proxy? No, not at all. Who thinks the above three are needed misunderstood how streaming media balances its loads. However, for HTTPS, we recommend using NGI

How to Secure SRS with Let's Encrypt by 1-Click

Introduction

As a CA(Certificate Authority), Let's Encrypt provides free and automatic TLS/SSL certificates, thereby enabling encrypted HTTPS for SRS Droplet. It's very easy to use, only by 1-Click.

HTTPS is required for publishing streams using WebRTC, and it adds security. If you want to use the video streaming in any HTTPS website, such as a WordPress website, you must use HLS/FLV/WebRTC with HTTPS, or it fails for security reasons.

Note that SRS droplet only supports a single domain name, which makes the problem simple, and easy to use.

# For Proxy Cache.
proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=srs_cache:8m max_size=1000m inactive=600m;
proxy_temp_path /tmp/nginx-cache/tmp;
server {
listen 80;
server_name your.domain.com;
# For Proxy Cache.
proxy_cache_valid 404 10s;
@winlinvip
winlinvip / client.go
Last active November 24, 2022 06:21
UDP/8000 check tool for WebRTC
/*
Usage:
go run client.go
go run client.go 101.201.77.240
See https://gist.github.com/winlinvip/e8665ba888e2fd489ccd5a449fadfa73
See https://stackoverflow.com/a/70576851/17679565
See https://github.com/ossrs/srs/issues/2843
*/
package main