Skip to content

Commit

Permalink
remove deprecated iab registry; properly handle registry prefix lengt…
Browse files Browse the repository at this point in the history
…hs. Closes #6
  • Loading branch information
thatmattlove committed Aug 1, 2024
1 parent 6de41ac commit e347cd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion oui/collect_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func ReadCSV(registry *Registry, fileName string, logger LoggerType) (results []
}
assignment := strings.TrimSpace(row[1])
if !strings.Contains(assignment, "/") {
assignment += "/24"
assignment += fmt.Sprintf("/%d", registry.DefaultPrefixLen)
}
organization := row[2]
org := strings.TrimSpace(organization)
Expand Down
18 changes: 9 additions & 9 deletions oui/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ const (
)

type Registry struct {
Name string
BaseURL string
FilePrefix string
FileExtension string
Name string
BaseURL string
FilePrefix string
FileExtension string
DefaultPrefixLen uint8
}

func (reg *Registry) URL() *url.URL {
Expand All @@ -39,10 +40,9 @@ func (reg *Registry) TempFilePattern() string {

func Registries() []*Registry {
return []*Registry{
{Name: REGISTRY_OUI, BaseURL: "https://standards-oui.ieee.org/oui", FilePrefix: "oui", FileExtension: "csv"},
{Name: REGISTRY_CID, BaseURL: "https://standards-oui.ieee.org/cid", FilePrefix: "cid", FileExtension: "csv"},
{Name: REGISTRY_IAB, BaseURL: "https://standards-oui.ieee.org/iab", FilePrefix: "iab", FileExtension: "csv"},
{Name: REGISTRY_OUI28, BaseURL: "https://standards-oui.ieee.org/oui28", FilePrefix: "mam", FileExtension: "csv"},
{Name: REGISTRY_OUI36, BaseURL: "https://standards-oui.ieee.org/oui36", FilePrefix: "oui36", FileExtension: "csv"},
{Name: REGISTRY_OUI, BaseURL: "https://standards-oui.ieee.org/oui", FilePrefix: "oui", FileExtension: "csv", DefaultPrefixLen: 24},
{Name: REGISTRY_CID, BaseURL: "https://standards-oui.ieee.org/cid", FilePrefix: "cid", FileExtension: "csv", DefaultPrefixLen: 24},
{Name: REGISTRY_OUI28, BaseURL: "https://standards-oui.ieee.org/oui28", FilePrefix: "mam", FileExtension: "csv", DefaultPrefixLen: 28},
{Name: REGISTRY_OUI36, BaseURL: "https://standards-oui.ieee.org/oui36", FilePrefix: "oui36", FileExtension: "csv", DefaultPrefixLen: 36},
}
}

0 comments on commit e347cd1

Please sign in to comment.