Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Refactor fun name
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust authored and AnGgIt86 committed Sep 28, 2024
1 parent 8693ba8 commit 83c7331
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 14 deletions.
14 changes: 7 additions & 7 deletions app/src/main/kotlin/com/neko/v2ray/util/AngConfigManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ object AngConfigManager {
return R.string.toast_none_data
}
val config = if (str.startsWith(EConfigType.VMESS.protocolScheme)) {
VmessFmt.parseVmess(str)
VmessFmt.parse(str)
} else if (str.startsWith(EConfigType.SHADOWSOCKS.protocolScheme)) {
ShadowsocksFmt.parseShadowsocks(str)
ShadowsocksFmt.parse(str)
} else if (str.startsWith(EConfigType.SOCKS.protocolScheme)) {
SocksFmt.parseSocks(str)
SocksFmt.parse(str)
} else if (str.startsWith(EConfigType.TROJAN.protocolScheme)) {
TrojanFmt.parseTrojan(str)
TrojanFmt.parse(str)
} else if (str.startsWith(EConfigType.VLESS.protocolScheme)) {
VlessFmt.parseVless(str)
VlessFmt.parse(str)
} else if (str.startsWith(EConfigType.WIREGUARD.protocolScheme)) {
WireguardFmt.parseWireguard(str)
WireguardFmt.parse(str)
} else if (str.startsWith(EConfigType.HYSTERIA2.protocolScheme)) {
Hysteria2Fmt.parseHysteria2(str)
Hysteria2Fmt.parse(str)
} else {
null
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/kotlin/com/neko/v2ray/util/fmt/Hysteria2Fmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package com.neko.v2ray.util.fmt

import android.text.TextUtils
import com.neko.v2ray.AppConfig
import com.neko.v2ray.AppConfig.LOOPBACK
import com.neko.v2ray.dto.EConfigType
import com.neko.v2ray.dto.Hysteria2Bean
import com.neko.v2ray.dto.ServerConfig
import com.neko.v2ray.dto.V2rayConfig
import com.neko.v2ray.extension.idnHost
Expand All @@ -12,7 +14,7 @@ import java.net.URI

object Hysteria2Fmt {

fun parseHysteria2(str: String): ServerConfig {
fun parse(str: String): ServerConfig {
var allowInsecure = settingsStorage?.decodeBool(AppConfig.PREF_ALLOW_INSECURE) ?: false
val config = ServerConfig.create(EConfigType.HYSTERIA2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.neko.v2ray.util.Utils
import java.net.URI

object ShadowsocksFmt {
fun parseShadowsocks(str: String): ServerConfig? {
fun parse(str: String): ServerConfig? {
val config = ServerConfig.create(EConfigType.SHADOWSOCKS)
if (!tryResolveResolveSip002(str, config)) {
var result = str.replace(EConfigType.SHADOWSOCKS.protocolScheme, "")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/neko/v2ray/util/fmt/SocksFmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.neko.v2ray.dto.V2rayConfig
import com.neko.v2ray.util.Utils

object SocksFmt {
fun parseSocks(str: String): ServerConfig? {
fun parse(str: String): ServerConfig? {
val config = ServerConfig.create(EConfigType.SOCKS)
var result = str.replace(EConfigType.SOCKS.protocolScheme, "")
val indexSplit = result.indexOf("#")
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/neko/v2ray/util/fmt/TrojanFmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.net.URI

object TrojanFmt {

fun parseTrojan(str: String): ServerConfig {
fun parse(str: String): ServerConfig {
var allowInsecure = settingsStorage?.decodeBool(AppConfig.PREF_ALLOW_INSECURE) ?: false
val config = ServerConfig.create(EConfigType.TROJAN)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/neko/v2ray/util/fmt/VlessFmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.net.URI

object VlessFmt {

fun parseVless(str: String): ServerConfig? {
fun parse(str: String): ServerConfig? {
var allowInsecure = settingsStorage?.decodeBool(AppConfig.PREF_ALLOW_INSECURE) ?: false
val config = ServerConfig.create(EConfigType.VLESS)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/neko/v2ray/util/fmt/VmessFmt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.net.URI

object VmessFmt {

fun parseVmess(str: String): ServerConfig? {
fun parse(str: String): ServerConfig? {
if (str.indexOf('?') > 0 && str.indexOf('&') > 0) {
return parseVmessStd(str)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.neko.v2ray.util.Utils
import java.net.URI

object WireguardFmt {
fun parseWireguard(str: String): ServerConfig? {
fun parse(str: String): ServerConfig? {
val uri = URI(Utils.fixIllegalUrl(str))
if (uri.rawQuery != null) {
val config = ServerConfig.create(EConfigType.WIREGUARD)
Expand Down

0 comments on commit 83c7331

Please sign in to comment.