oui

package
v2.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: BSD-3-Clause-Clear Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REGISTRY_OUI   string = "MA-L"
	REGISTRY_OUI36 string = "MA-S"
	REGISTRY_OUI28 string = "MA-M"
	REGISTRY_IAB   string = "IAB"
	REGISTRY_CID   string = "CID"
)

Variables

This section is empty.

Functions

func DownloadCSV

func DownloadCSV(registry *Registry) (fileName string, err error)

Types

type Formats

type Formats struct {
	Hex    string
	Dotted string
	Dashed string
	Int    int64
	Bytes  string
}

func Convert

func Convert(i string) (fmts *Formats, err error)

type LoggerType

type LoggerType interface {
	Success(s string, f ...interface{})
	Info(s string, f ...interface{})
	Warn(s string, f ...interface{})
	Error(s string, f ...interface{})
	Err(err error, strs ...string)
}

type OUIDB

type OUIDB struct {
	Connection *sql.DB
	Version    string
	Progress   *progress.Progress
	Logger     *LoggerType
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (*OUIDB, error)

func (*OUIDB) BulkInsert added in v2.0.2

func (ouidb *OUIDB) BulkInsert(defs []*VendorDef) (int64, error)

func (*OUIDB) Clear

func (ouidb *OUIDB) Clear() (err error)

func (*OUIDB) Close

func (ouidb *OUIDB) Close() error

func (*OUIDB) Count

func (ouidb *OUIDB) Count() (count int64, err error)

func (*OUIDB) Delete

func (ouidb *OUIDB) Delete() error

func (*OUIDB) Find

func (ouidb *OUIDB) Find(search string) ([]*VendorDef, error)

func (*OUIDB) Insert

func (ouidb *OUIDB) Insert(d *VendorDef) (res sql.Result, err error)

func (*OUIDB) Populate

func (ouidb *OUIDB) Populate() (records int64, err error)

type Option

type Option func(*Options)

func CreatePostgresOption

func CreatePostgresOption(connectionString string) (Option, error)

func CreateSQLiteOption

func CreateSQLiteOption(optionalFileName ...string) (Option, error)

func WithConnection

func WithConnection(conn *sql.DB) Option

func WithLogging

func WithLogging(logger LoggerType) Option

func WithMaxConnections added in v2.0.2

func WithMaxConnections(max uint) Option

func WithProgress

func WithProgress(p *progress.Progress) Option

func WithVersion

func WithVersion(version string) Option

type Options

type Options struct {
	Logger     *LoggerType
	Progress   *progress.Progress
	Version    string
	Connection *sql.DB

	MaxConnections uint
	// contains filtered or unexported fields
}

type Registry

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

func Registries

func Registries() []*Registry

func (*Registry) FileName

func (reg *Registry) FileName() string

func (*Registry) TempFilePattern

func (reg *Registry) TempFilePattern() string

func (*Registry) URL

func (reg *Registry) URL() *url.URL

type VendorDef

type VendorDef struct {
	Prefix   string
	Length   int
	Org      string
	Registry string
}

func CollectAll

func CollectAll(p *progress.Progress, logger LoggerType) ([]*VendorDef, error)

func ReadCSV

func ReadCSV(registry *Registry, fileName string, logger LoggerType) (results []*VendorDef)

func (*VendorDef) PrefixString

func (v *VendorDef) PrefixString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL