2023-02-15 00:53:53 +07:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2024-01-04 16:28:16 +07:00
|
|
|
* Copyright (c) 2022-2024, daeuniverse Organization <dae@v2raya.org>
|
2023-02-15 00:53:53 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
package consts
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type DialMode string
|
|
|
|
|
|
|
|
const (
|
2023-02-17 00:07:27 +07:00
|
|
|
DialMode_Ip DialMode = "ip"
|
|
|
|
DialMode_Domain DialMode = "domain"
|
|
|
|
DialMode_DomainPlus DialMode = "domain+"
|
2023-03-14 17:22:00 +07:00
|
|
|
DialMode_DomainCao DialMode = "domain++"
|
2023-02-15 00:53:53 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
func ParseDialMode(mode string) (DialMode, error) {
|
|
|
|
switch mode {
|
2023-03-14 17:22:00 +07:00
|
|
|
case "ip", "domain", "domain+", "domain++":
|
2023-02-15 00:53:53 +07:00
|
|
|
return DialMode(mode), nil
|
|
|
|
default:
|
|
|
|
return "", fmt.Errorf("unsupported dial mode: %v", mode)
|
|
|
|
}
|
|
|
|
}
|