refactor(meta): 为 ProxyConfig 覆盖 toString 方法.

覆盖 toString 方法后, 可以输出易懂的代理信息(我担心按照 data class 的格式输出, 用户可能看不懂).
This commit is contained in:
LamGC 2022-07-16 20:26:45 +08:00
parent 93685e9440
commit e8711e9974
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -72,8 +72,16 @@ enum class ProxyType {
data class ProxyConfig( data class ProxyConfig(
val type: ProxyType = ProxyType.NO_PROXY, val type: ProxyType = ProxyType.NO_PROXY,
val host: String = "127.0.0.1", val host: String = "127.0.0.1",
val port: Int = 1080 val port: Int = 1080,
) ) {
override fun toString(): String {
return if (type != ProxyType.NO_PROXY) {
"$type://$host:$port"
} else {
"NO_PROXY"
}
}
}
/** /**
* ScalaBot 的运行指标公开配置. * ScalaBot 的运行指标公开配置.