Files
CrowsNest/internal/files/filetype.go
Evan Hosinski 65c4ea6a15 Updates to allow for enhanced debugging.
Added structs for whois calls.

Added ability to write WhoIs to file.

Added structured output for Whois Records.

Added String Method for WhoIsRecord and WhoIsHistory Records.
2025-05-16 15:33:29 -04:00

46 lines
557 B
Go

package files
type FileType int32
const (
JSON FileType = iota
XML
YAML
TEXT
UNKNOWN
)
func GetFileType(filetype string) FileType {
switch filetype {
case "json":
return JSON
case "xml":
return XML
case "yaml":
return YAML
case "txt":
return TEXT
default:
return JSON
}
}
func (ft FileType) String() string {
switch ft {
case JSON:
return "json"
case XML:
return "xml"
case YAML:
return "yaml"
case TEXT:
return "txt"
default:
return "json"
}
}
func (ft FileType) Extension() string {
return "." + ft.String()
}