[+] 终端

This commit is contained in:
acgist
2022-11-13 00:58:07 +08:00
parent 605e0fbbe7
commit 4ce21553c3
48 changed files with 1623 additions and 192 deletions

View File

@@ -75,7 +75,7 @@ import lombok.extern.slf4j.Slf4j;
@Configuration
@EnableScheduling
@EnableAspectJAutoProxy(exposeProxy = true)
@EnableConfigurationProperties({ IdProperties.class, TaoyaoProperties.class, WebrtcProperties.class, SecurityProperties.class })
@EnableConfigurationProperties({ IdProperties.class, MediaProperties.class, TaoyaoProperties.class, WebrtcProperties.class, SecurityProperties.class })
public class BootAutoConfiguration {
@Value("${spring.application.name:taoyao}")

View File

@@ -0,0 +1,56 @@
package com.acgist.taoyao.boot.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* 音频配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "音频配置", description = "音频配置")
public class MediaAudioProperties {
/**
* 音频格式
*
* @author acgist
*/
public enum Format {
/**
* ACC
*/
ACC,
/**
* PCM
*/
PCM,
/**
* OPUS
*/
OPUS;
}
/**
* 格式
*/
@Schema(title = "格式", description = "格式")
private Format format;
/**
* 采样率
* 8000|16000|32000|48000
*/
@Schema(title = "采样率", description = "采样率", example = "8000|16000|32000|48000")
private Integer samplerate;
/**
* 采样数
*/
@Schema(title = "采样数", description = "采样数", example = "16")
private Integer samplesize;
}

View File

@@ -0,0 +1,29 @@
package com.acgist.taoyao.boot.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* 媒体配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "媒体配置", description = "媒体配置")
@ConfigurationProperties(prefix = "taoyao.media")
public class MediaProperties {
/**
* 音频配置
*/
private MediaAudioProperties audio;
/**
* 视频配置
*/
private MediaVideoProperties video;
}

View File

@@ -0,0 +1,96 @@
package com.acgist.taoyao.boot.config;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
* 视频配置
*
* @author acgist
*/
@Getter
@Setter
@Schema(title = "视频配置", description = "视频配置")
public class MediaVideoProperties {
/**
* 视频格式
*
* @author acgist
*/
public enum Format {
/**
* VP8
*/
VP8,
/**
* VP9
*/
VP9,
/**
* H264
*/
H264,
/**
* H265
*/
H265;
}
/**
* 格式
*/
@Schema(title = "格式", description = "格式")
private Format format;
/**
* 码率(画质)
*/
@Schema(title = "码率", description = "码率影响画质", example = "600|1200|1500|1800")
private Integer bitrate;
/**
* 帧率(流畅)
*/
@Schema(title = "帧率", description = "帧率影响流程", example = "20|24|30|60")
private Integer framerate;
/**
* 分辨率(画面大小)
*/
@Schema(title = "分辨率", description = "分辨率影响画面大小", example = "1920*1080|1280*720|480*360")
private String resolution;
/**
* 宽度
*/
@Schema(title = "宽度", description = "宽度")
private Integer width;
/**
* 高度
*/
@Schema(title = "高度", description = "高度")
private Integer height;
/**
* @return 宽度
*/
public Integer getWidth() {
if(this.width == null) {
final int index = this.resolution.indexOf('*');
this.width = Integer.valueOf(this.resolution.substring(0, index).strip());
}
return this.width;
}
/**
* @return 高度
*/
public Integer getHeight() {
if(this.height == null) {
final int index = this.resolution.indexOf('*');
this.height = Integer.valueOf(this.resolution.substring(index + 1).strip());
}
return this.height;
}
}

View File

@@ -29,7 +29,7 @@ public class SecurityProperties {
*/
private String[] permit;
/**
* 用户
* 名称
*/
private String username;
/**

View File

@@ -18,11 +18,11 @@ import lombok.Setter;
public class WebrtcProperties {
/**
* 架构
* 架构
*
* @author acgist
*/
public enum Type {
public enum Model {
/**
* SFU架构
@@ -40,10 +40,33 @@ public class WebrtcProperties {
}
/**
* 类型
* 基础框架
*
* @author acgist
*/
@Schema(title = "架构类型", description = "WebRTC架构类型")
private Type type;
public enum Framework {
/**
* jitsi
*/
JITSI,
/**
* kurento
*/
KURENTO;
}
/**
* 模型
*/
@Schema(title = "架构模型", description = "WebRTC架构模型")
private Model model;
/**
* 框架
*/
@Schema(title = "基础框架", description = "WebRTC基础框架")
private Framework framework;
/**
* stun服务器
*/

View File

@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" scanPeriod="60 seconds" debug="false">
<springProperty scope="context" name="system.name" source="spring.application.name" />
<springProperty scope="context" name="log.name" source="spring.application.name" />
<contextName>${system.name}</contextName>
<property name="system.path" value="logs" />
<property name="system.queue" value="2048" />
<property name="system.buffer" value="8192" />
<property name="system.history" value="30" />
<property name="system.charset" value="UTF-8" />
<property name="system.pattern" value="[${system.name}] %d{YYYY-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} %file:%line - %m%n" />
<contextName>${log.name}</contextName>
<property name="log.path" value="logs" />
<property name="log.queue" value="2048" />
<property name="log.buffer" value="8192" />
<property name="log.history" value="30" />
<property name="log.charset" value="UTF-8" />
<property name="log.pattern" value="[${log.name}] %d{YYYY-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} %file:%line - %m%n" />
<appender name="fileDebug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${system.path}/${system.name}.debug.log</file>
<file>${log.path}/${log.name}.debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<maxHistory>${system.history}</maxHistory>
<fileNamePattern>${system.path}/%d{yyyy-MM, aux}/${system.name}.debug.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<maxHistory>${log.history}</maxHistory>
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/${log.name}.debug.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
</rollingPolicy>
<bufferSize>${system.buffer}</bufferSize>
<bufferSize>${log.buffer}</bufferSize>
<immediateFlush>false</immediateFlush>
<encoder>
<charset>${system.charset}</charset>
<pattern>${system.pattern}</pattern>
<charset>${log.charset}</charset>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
@@ -29,22 +29,22 @@
</appender>
<appender name="fileDebugAsync" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="fileDebug" />
<queueSize>${system.queue}</queueSize>
<queueSize>${log.queue}</queueSize>
<includeCallerData>true</includeCallerData>
<discardingThreshold>0</discardingThreshold>
</appender>
<appender name="fileInfo" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${system.path}/${system.name}.info.log</file>
<file>${log.path}/${log.name}.info.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<maxHistory>${system.history}</maxHistory>
<fileNamePattern>${system.path}/%d{yyyy-MM, aux}/${system.name}.info.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<maxHistory>${log.history}</maxHistory>
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/${log.name}.info.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
</rollingPolicy>
<bufferSize>${system.buffer}</bufferSize>
<bufferSize>${log.buffer}</bufferSize>
<immediateFlush>false</immediateFlush>
<encoder>
<charset>${system.charset}</charset>
<pattern>${system.pattern}</pattern>
<charset>${log.charset}</charset>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
@@ -52,22 +52,22 @@
</appender>
<appender name="fileInfoAsync" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="fileInfo" />
<queueSize>${system.queue}</queueSize>
<queueSize>${log.queue}</queueSize>
<includeCallerData>true</includeCallerData>
<discardingThreshold>0</discardingThreshold>
</appender>
<appender name="fileError" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${system.path}/${system.name}.error.log</file>
<file>${log.path}/${log.name}.error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<maxHistory>${system.history}</maxHistory>
<fileNamePattern>${system.path}/%d{yyyy-MM, aux}/${system.name}.error.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
<maxHistory>${log.history}</maxHistory>
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/${log.name}.error.%d{yyyy-MM-dd}.log.gz</fileNamePattern>
</rollingPolicy>
<bufferSize>${system.buffer}</bufferSize>
<bufferSize>${log.buffer}</bufferSize>
<immediateFlush>false</immediateFlush>
<encoder>
<charset>${system.charset}</charset>
<pattern>${system.pattern}</pattern>
<charset>${log.charset}</charset>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
@@ -75,15 +75,15 @@
</appender>
<appender name="fileErrorAsync" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="fileError" />
<queueSize>${system.queue}</queueSize>
<queueSize>${log.queue}</queueSize>
<includeCallerData>true</includeCallerData>
<discardingThreshold>0</discardingThreshold>
</appender>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>${system.charset}</charset>
<pattern>${system.pattern}</pattern>
<charset>${log.charset}</charset>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>