From 749ea644f15b136a8ee7d32140c6929390818857 Mon Sep 17 00:00:00 2001 From: LamGC Date: Sun, 5 Sep 2021 14:32:58 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E8=A1=A5=E5=85=85=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=86=85=E5=AE=B9,=20=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E9=94=99=E8=AF=AF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sentry/common/logging/LevelRangeFilter.java | 9 +++++++++ .../sentry/common/logging/MarkerFilter.java | 15 +++++++++++++++ .../oracle/sentry/oci/compute/ssh/SshSession.java | 8 ++++++-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/lamgc/oracle/sentry/common/logging/LevelRangeFilter.java b/src/main/java/net/lamgc/oracle/sentry/common/logging/LevelRangeFilter.java index df4748e..c2f2c43 100644 --- a/src/main/java/net/lamgc/oracle/sentry/common/logging/LevelRangeFilter.java +++ b/src/main/java/net/lamgc/oracle/sentry/common/logging/LevelRangeFilter.java @@ -24,10 +24,19 @@ public class LevelRangeFilter extends Filter { return FilterReply.NEUTRAL; } + /** + * 设置最高等级. + *

仅限 XML 配置文件设置. + * @param maxLevel 最高等级(包括). + */ public void setMaxLevel(String maxLevel) { this.maxLevel = Level.toLevel(maxLevel); } + /** + * 设置最低等级. + * @param minLevel 允许的最低等级(包括). + */ public void setMinLevel(String minLevel) { this.minLevel = Level.toLevel(minLevel); } diff --git a/src/main/java/net/lamgc/oracle/sentry/common/logging/MarkerFilter.java b/src/main/java/net/lamgc/oracle/sentry/common/logging/MarkerFilter.java index 295d293..48f65f7 100644 --- a/src/main/java/net/lamgc/oracle/sentry/common/logging/MarkerFilter.java +++ b/src/main/java/net/lamgc/oracle/sentry/common/logging/MarkerFilter.java @@ -3,6 +3,7 @@ package net.lamgc.oracle.sentry.common.logging; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; +import org.slf4j.Marker; /** * @author LamGC @@ -19,14 +20,28 @@ public class MarkerFilter extends Filter { return event.getMarker() != null && event.getMarker().getName().equals(markerName) ? onMatch : onMismatch; } + /** + * 设置要匹配的 {@link Marker} 名称. + * @param markerName Marker 名称. + */ public void setMarkerName(String markerName) { this.markerName = markerName; } + /** + * 如果匹配, 需要执行的操作. + * @see FilterReply + * @param onMatch 操作名称. + */ public void setOnMatch(String onMatch) { this.onMatch = FilterReply.valueOf(onMatch); } + /** + * 如果不匹配, 需要执行的操作. + * @see FilterReply + * @param onMismatch 操作名称. + */ public void setOnMismatch(String onMismatch) { this.onMismatch = FilterReply.valueOf(onMismatch); } diff --git a/src/main/java/net/lamgc/oracle/sentry/oci/compute/ssh/SshSession.java b/src/main/java/net/lamgc/oracle/sentry/oci/compute/ssh/SshSession.java index 5b81c95..72dd547 100644 --- a/src/main/java/net/lamgc/oracle/sentry/oci/compute/ssh/SshSession.java +++ b/src/main/java/net/lamgc/oracle/sentry/oci/compute/ssh/SshSession.java @@ -49,8 +49,11 @@ public class SshSession implements Closeable { /** * 创建本地 TCP 转发隧道. - *

该隧道为方向为 "本地->远端" (本地发起连接转发至远端端口). + *

该隧道为方向为 "本地->远端" (本地发起连接转发至远端端口). + * @param localPort 本地监听端口. + * @param remotePort 远端目标端口. * @return 返回 TCP 转发通道对象, 可获取通道信息和关闭通道. + * @throws IOException 当操作失败时抛出该异常. */ public TcpForwardingChannel createLocalTcpForwarding(int localPort, int remotePort) throws IOException { ExplicitPortForwardingTracker tracker = clientSession @@ -60,10 +63,11 @@ public class SshSession implements Closeable { /** * 创建远端 TCP 转发隧道. - *

该隧道为方向为 "本地<-远端" (远端服务器发起连接转发至本地端口). + *

该隧道为方向为 "本地<-远端" (远端服务器发起连接转发至本地端口). * @param remotePort 远端监听端口号, 该端口为远端服务连接转发的端口号. * @param localPort 本地连接端口号, 该端口为本地服务端的端口号. * @return 返回 Tcp 转发通道对象, 用于管理转发通道. + * @throws IOException 当操作失败时抛出异常. */ public TcpForwardingChannel createRemoteTcpForwarding(int remotePort, int localPort) throws IOException { ExplicitPortForwardingTracker tracker =