### Start Services with Docker Compose Source: https://github.com/bestruirui/bestsub/blob/dev/README.md Command to start the services defined in your `docker-compose.yml` file in detached mode. ```bash docker-compose up -d ``` -------------------------------- ### Run BestSub with Docker Source: https://github.com/bestruirui/bestsub/blob/dev/README.md Use this command to run BestSub in a Docker container. Ensure to replace `/path/to/data` with your actual data directory for persistence. The service will be accessible at `http://localhost:8080`. ```bash docker run -d \ --name bestsub \ -e PU ID=1000 \ -e PGID=1000 \ --restart unless-stopped \ -v /path/to/data:/app/data \ -p 8080:8080 \ ghcr.io/bestruirui/bestsub ``` -------------------------------- ### 数字格式化节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 使用 `printf` 函数将节点序号格式化为三位数(不足补零),并显示国家/地区中文名称。适用于需要统一数字格式的场景。 ```go {{printf "%03d" .Count}}-{{.Country.NameZh}} ``` -------------------------------- ### Deploy BestSub with Docker Compose Source: https://github.com/bestruirui/bestsub/blob/dev/README.md This Docker Compose configuration sets up BestSub and its companion service `minisubconvert`. It includes environment variables for user/group IDs, port mapping, and volume for data persistence. ```yaml services: bestsub: image: ghcr.io/bestruirui/bestsub:latest container_name: bestsub restart: unless-stopped environment: - PU ID=1000 - PGID=1000 ports: - "8080:8080" volumes: - ./data:/app/data minisubconvert: image: ghcr.io/bestruirui/minisubconvert:latest container_name: minisubconvert restart: unless-stopped environment: - PU ID=1000 - PGID=1000 ports: - "3000:3000" ``` -------------------------------- ### 视频流媒体专用节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 为视频流媒体场景设计的模板,包含电视图标、国家/地区信息以及根据下行速度判断的视频质量(4K, 1080P, 720P)。适用于需要高带宽的流媒体场景。 ```go 📺{{.Country.Emoji}}{{.Country.NameZh}}-{{if ge .SpeedDown 25600}}4K{{else if ge .SpeedDown 10240}}1080P{{else}}720P{{end}} ``` -------------------------------- ### 简单节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 仅使用节点序号来命名节点。适用于需要简单、顺序标识的场景。 ```go 节点{{.Count}} ``` -------------------------------- ### 完整信息节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 包含格式化后的节点序号、国家/地区信息、延迟和下行速度。提供详尽的节点性能数据。 ```go {{printf "%03d" .Count}}-{{.Country.Emoji}}{{.Country.NameZh}}-{{.Delay}}ms-{{div .SpeedDown 1024}}MB/s ``` -------------------------------- ### 下载专用格式模板 (高速度优先) Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 显示节点的下行速度(以MB/s为单位)、国家/地区表情符号和中文名称。适用于需要关注下载速度的场景。 ```go {{div .SpeedDown 1024}}MB/s-{{.Country.Emoji}}{{.Country.NameZh}} ``` -------------------------------- ### 质量评级节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据延迟时间对节点进行质量评级(极速、快速、普通),并显示国家/地区信息。适用于需要快速评估节点质量的场景。 ```go {{.Country.Emoji}}{{.Country.NameZh}}-{{if le .Delay 50}}极速{{else if le .Delay 100}}快速{{else}}普通{{end}} ``` -------------------------------- ### 字符串处理示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 展示了如何使用 `printf` 函数格式化字符串,例如将节点序号格式化为三位数。 ```go {{printf "%03d" .Count}} ``` -------------------------------- ### 工作办公专用节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 为工作办公场景设计的模板,包含公文包图标、国家/地区名称、延迟稳定性判断和下行速度(MB)。适用于需要稳定连接的办公场景。 ```go 💼{{.Country.NameZh}}-{{if le .Delay 100}}稳定{{else}}一般{{end}}-{{div .SpeedDown 1024}}MB ``` -------------------------------- ### 游戏玩家格式模板 (低延迟优先) Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据延迟时间为节点添加表情符号标识(🚀, ⚡, 🐌),并显示国家/地区中文名称。适用于对延迟敏感的游戏场景。 ```go {{if le .Delay 50}}🚀{{else if le .Delay 100}}⚡{{else}}🐌{{end}}{{.Country.NameZh}} ``` -------------------------------- ### 条件判断节点命名模板 (风险等级) Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据节点的风险等级(1, 2, 3)显示不同的图标(✅, ⚠️, ❌),并附带国家/地区中文名称。适用于需要直观展示节点风险的场景。 ```go {{.Country.NameZh}}{{if eq .Risk 1}}✅{{else if eq .Risk 2}}⚠️{{else}}❌{{end}} ``` -------------------------------- ### Convert KB/s to MB/s Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Use the `div` function to convert speed from KB/s to MB/s. Ensure the divisor is 1024 for accurate conversion. ```Go Template {{div .SpeedDown 1024}}MB/s ``` -------------------------------- ### 开发者专用节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 为开发者设计的模板,包含国家/地区英文名、格式化节点序号、延迟、下行速度(MB)和风险等级。提供详细的技术信息。 ```go {{.Country.NameEn}}{{printf "%03d" .Count}}|{{.Delay}}ms|{{div .SpeedDown 1024}}MB|Risk{{.Risk}} ``` -------------------------------- ### 速度质量标识节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据下行速度大小为节点添加速度标识(🚀, ⚡, 🐌),并显示国家/地区名称。适用于需要快速区分节点速度等级的场景。 ```go {{if ge .SpeedDown 51200}}🚀{{else if ge .SpeedDown 10240}}⚡{{else}}🐌{{end}}{{.Country.NameZh}} ``` -------------------------------- ### 数学运算示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 演示了如何使用 `add`, `sub`, `div`, `mod` 函数进行基本的数学运算,例如节点序号加1,或计算下行速度的MB值。 ```go {{add .Count 1}} ``` ```go {{sub 100 .Delay}} ``` ```go {{div .SpeedDown 1024}} ``` ```go {{mod .Count 2}} ``` -------------------------------- ### 专业监控风格节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 提供类似专业监控的节点信息格式,包括国家/地区英文名、延迟(Ping)、下行速度(MB/s)和风险等级。适用于需要详细监控数据的场景。 ```go [{{.Country.NameEn}}] Ping:{{.Delay}}ms|Down:{{div .SpeedDown 1024}}MB/s|Risk:{{.Risk}} ``` -------------------------------- ### 游戏玩家专用节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 为游戏玩家设计的模板,包含游戏手柄图标、格式化节点序号、国家/地区信息以及根据延迟评定的星级。适用于游戏场景。 ```go 🎮{{printf "%03d" .Count}}-{{.Country.Emoji}}{{.Country.NameZh}}-{{if le .Delay 50}}4星{{else if le .Delay 100}}3星{{else}}2星{{end}} ``` -------------------------------- ### 质量评分系统节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据下行速度和延迟综合评分节点质量(S, A, B, C)。适用于需要量化节点性能的场景。 ```go {{.Country.Emoji}}{{.Country.NameZh}}-{{if ge .SpeedDown 51200}}{{if le .Delay 50}}S{{else if le .Delay 100}}A{{else}}B{{end}}{{else if ge .SpeedDown 10240}}{{if le .Delay 50}}A{{else if le .Delay 100}}B{{else}}C{{end}}{{else}}C{{end}} ``` -------------------------------- ### 带国家信息的节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 在节点名称前添加国家/地区的中文名称,后跟节点序号。适用于需要区分节点所在国家/地区的场景。 ```go {{.Country.NameZh}}-节点{{.Count}} ``` -------------------------------- ### 带国旗和国家信息的节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 使用国家/地区的表情符号旗帜、中文名称和节点序号来命名节点。提供直观的地理位置标识。 ```go {{.Country.Emoji}}{{.Country.NameZh}}-{{.Count}} ``` -------------------------------- ### 数组循环示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 展示了如何使用 `range` 循环遍历订阅标签数组,并用竖线分隔每个标签。适用于需要处理列表数据的场景。 ```go <{{range $i, $v := .SubTags}}{{if $i}}|{{end}}{{$v}}{{end}}> ``` -------------------------------- ### 比较运算示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 展示了如何使用 `eq`, `ne`, `lt`, `le`, `gt`, `ge` 函数进行比较运算,例如判断风险等级是否等于1,或延迟是否小于50ms。 ```go {{if eq .Risk 1}}安全{{end}} ``` ```go {{if ne .Delay 0}}正常{{end}} ``` ```go {{if lt .Delay 50}}极速{{end}} ``` ```go {{if le .Delay 100}}快速{{end}} ``` ```go {{if gt .SpeedDown 51200}}高速{{end}} ``` ```go {{if ge .SpeedDown 10240}}可用{{end}} ``` -------------------------------- ### Display Icon Based on Speed Threshold Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Conditionally display an icon (🚀 or ⚡) based on whether the download speed (`SpeedDown`) meets a specific threshold (51200 KB/s). ```Go Template {{if ge .SpeedDown 51200}}🚀{{else}}⚡{{end}} ``` -------------------------------- ### 逻辑运算示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 演示了如何使用 `and`, `or`, `not` 函数组合逻辑条件,例如同时满足高速和低延迟,或判断风险等级不等于3。 ```go {{if and (ge .SpeedDown 51200) (le .Delay 50)}}极品{{end}} ``` ```go {{if or (le .Delay 50) (ge .SpeedDown 51200)}}推荐{{end}} ``` ```go {{if not (eq .Risk 3)}}安全{{end}} ``` -------------------------------- ### Conditional Performance Grading with Icons Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Combine multiple conditions using `and`, `ge` (greater than or equal to), and `le` (less than or equal to) to assign performance grades (🚀, ⚡, 🐌) based on speed and delay. Appends the country name. ```Go Template {{if and (ge .SpeedDown 51200) (le .Delay 50)}}🚀{{else if and (ge .SpeedDown 10240) (le .Delay 100)}}⚡{{else}}🐌{{end}}{{.Country.NameZh}} ``` -------------------------------- ### 延迟分级节点命名模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 根据延迟时间将节点分为不同等级(极速、快速、普通、较慢),并显示国家/地区名称。适用于需要精细化评估节点延迟的场景。 ```go {{if le .Delay 50}}极速{{else if le .Delay 100}}快速{{else if le .Delay 200}}普通{{else}}较慢{{end}}-{{.Country.NameZh}} ``` -------------------------------- ### 简洁美观格式模板 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 使用国家/地区表情符号、中文名称和延迟来格式化节点名称。适用于需要快速识别节点位置和响应速度的场景。 ```go {{.Country.Emoji}}{{.Country.NameZh}}-{{.Delay}}ms ``` -------------------------------- ### Smart Speed Unit Conversion Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Conditionally display speed in MB/s if it's greater than or equal to 1024 KB/s, otherwise display in KB/s. This provides a more human-readable format. ```Go Template {{if ge .SpeedDown 1024}}{{div .SpeedDown 1024}}MB/s{{else}}{{.SpeedDown}}KB/s{{end}} ``` -------------------------------- ### 字符串切片示例 Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md 演示了如何使用 `slice` 函数提取字符串的子串,例如获取国家/地区英文名的前两位。 ```go {{slice .Country.NameEn 0 2}} ``` -------------------------------- ### Risk Identification with Color Indicators Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Display country emoji and name, followed by a color-coded indicator (🟢, 🟡, 🟠, 🔴) based on the risk level. Uses `eq` for exact matches and `else` for the default case. ```Go Template {{.Country.Emoji}}{{.Country.NameZh}}{{if eq .Risk 1}}🟢{{else if eq .Risk 2}}🟡{{else if eq .Risk 3}}🟠{{else}}🔴{{end}} ``` -------------------------------- ### Performance Leveling Based on Delay Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Assign performance levels (S+, S, A, B, C) based on the delay value using a series of `if-else if` conditions. Prefixes the country name. ```Go Template {{.Country.NameZh}}-{{if le .Delay 30}}S+{{else if le .Delay 50}}S{{else if le .Delay 100}}A{{else if le .Delay 200}}B{{else}}C{{end}} ``` -------------------------------- ### Convert Milliseconds to Seconds Source: https://github.com/bestruirui/bestsub/blob/dev/docs/rename/README.md Convert delay from milliseconds to seconds using `div` for whole seconds and `mod` for remaining milliseconds. Display with a decimal point. ```Go Template {{div .Delay 1000}}.{{mod .Delay 1000}}s ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.