文件大小

const (
    B  = 1
    KB = 1024 * B
    MB = 1024 * KB
    GB = 1024 * MB
)



const (
    TimeYMDHIS   = "2006-01-02 15:04:05"
    TimeYMD      = "2006-01-02"
    TimeHIS      = "15:04:05"
    AsiaShanghai = "Asia/Shanghai"

    TimeFormat       = "15:04:05"
    DateFormat       = "2006-01-02"
    DateTimeFormat   = "2006-01-02 15:04:05"
    DateTimeTFormat  = "2006-01-02T15:04:05"
    DateTimeFormatEn = "2006-01-02 at 15:04:05"
)


type IPType int

const (
    AllIPType IPType = iota + 1
    IPv6
    IPv4
)

// 调用 IPv4.String()  / 输出IPv4
func (w IPType) String() string {
    switch w {
    case IPv4:
        return "IPv4"
    case IPv6:
        return "IPv6"
    case AllIPType:
        return "All"
    }
    return ""
}


func (w IPType) SortString() string {
    switch w {
    case IPv4:
        return "v4"
    case IPv6:
        return "v6"
    case AllIPType:
        return "all"
    }
    return ""
}

func (w IPType) Type() int64 {
    switch w {
    case IPv4:
        return 2
    case IPv6:
        return 1
    case AllIPType:
        return 0
    }
    return 0
}

// ==============================================
// Data types available in valid JSON data.
type ValueType int

const (
    NotExist = ValueType(iota)
    String
    Number
    Object
    Array
    Boolean
    Null
    Unknown
)

// 调用 Object.String()  / 输出object
func (vt ValueType) String() string {
    switch vt {
    case NotExist:
        return "non-existent"
    case String:
        return "string"
    case Number:
        return "number"
    case Object:
        return "object"
    case Array:
        return "array"
    case Boolean:
        return "boolean"
    case Null:
        return "null"
    default:
        return "unknown"
    }
}

func GetTestType(value int64) string {
    switch value {
    case 1:
        return "11"
    case 2:
        return "22"
    default:
        return "33"
    }
}



TaskStatsMapping = map[string]string{
    "-1": "待暂停",
    "0":  "未启动",
    "1":  "任务已提交",
    "2":  "扫描中",
    "3":  "停止中",
    "4":  "已停止",
    "5":  "扫描成功",
    "6":  "扫描失败",
    "7":  "已下发",
    "8":  "停止失败",
    "11": "待审核",
    "12": "审核失败",
}
// GetTaskStateCN 获取任务状态中文
func GetTaskStateCN(state string) string {
    cn, ok := TaskStatsMapping[state]
    if ok {
        return cn
    }
    return "未知"
}

// Errors
var (
    KeyPathNotFoundError       = errors.New("Key path not found")
    UnknownValueTypeError      = errors.New("Unknown value type")
    MalformedJsonError         = errors.New("Malformed JSON error")
    MalformedStringError       = errors.New("Value is string, but can't find closing '\"' symbol")
    MalformedArrayError        = errors.New("Value is array, but can't find closing ']' symbol")
    MalformedObjectError       = errors.New("Value looks like object, but can't find closing '}' symbol")
    MalformedValueError        = errors.New("Value looks like Number/Boolean/None, but can't find its end: ',' or '}' symbol")
    OverflowIntegerError       = errors.New("Value is number, but overflowed while parsing")
    MalformedStringEscapeError = errors.New("Encountered an invalid escape sequence in a string")
)

var App_Simulate_Group []int = []int{App_Simulate_Type_PC, App_Simulate_Type_Android, App_Simulate_Type_IOS}


var (
    PriorityMode = []map[string]interface{}{
        {
            "name":  "高",
            "value": 1,
        },
        {
            "name":  "中",
            "value": 2,
        },
        {
            "name":  "低",
            "value": 3,
        },
        {
            "name":  "特殊",
            "value": 4,
        },
    }

)

WeekMapping = map[string]string{
        "1": "周一",
        "2": "周二",
        "3": "周三",
        "4": "周四",
        "5": "周五",
        "6": "周六",
        "7": "周日",
    }