dae/common/consts/control.go

26 lines
502 B
Go
Raw Normal View History

/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (c) 2022-2023, v2rayA Organization <team@v2raya.org>
*/
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+"
)
func ParseDialMode(mode string) (DialMode, error) {
switch mode {
2023-02-17 00:07:27 +07:00
case "ip", "domain", "domain+":
return DialMode(mode), nil
default:
return "", fmt.Errorf("unsupported dial mode: %v", mode)
}
}