mirror of
https://github.com/LamGC/ScalaBot.git
synced 2025-04-30 06:37:29 +00:00
refactor(meta): 为 ProxyConfig 覆盖 toString 方法.
覆盖 toString 方法后, 可以输出易懂的代理信息(我担心按照 data class 的格式输出, 用户可能看不懂).
This commit is contained in:
parent
93685e9440
commit
e8711e9974
@ -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 的运行指标公开配置.
|
||||||
|
Loading…
Reference in New Issue
Block a user