diff --git a/types/zone.go b/types/zone.go new file mode 100644 index 0000000..1177427 --- /dev/null +++ b/types/zone.go @@ -0,0 +1,20 @@ +package types + +import ( + "bytes" + "fmt" +) + +type ( + Zone string +) + +func (z *Zone) UnmarshalJSON(in []byte) error { + in = bytes.Trim(in, `"`) + + if in[len(in)-1] != '.' { + return fmt.Errorf("not a valid zone name") + } + *z = Zone(in) + return nil +}