feat: publish standalone worker

Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
Gleb Tv
2026-07-13 17:55:14 +03:00
Коммит 2c7a0236da
309 изменённых файлов: 44004 добавлений и 0 удалений

43
internal/netaddr/macaddr.go Обычный файл
Просмотреть файл

@@ -0,0 +1,43 @@
package netaddr
import (
"database/sql/driver"
"errors"
"net"
)
// Macaddr is a wrapper for transferring Macaddr values back and forth easily.
type Macaddr struct {
Macaddr net.HardwareAddr
Valid bool
}
// Scan implements the Scanner interface.
func (m *Macaddr) Scan(value interface{}) error {
m.Macaddr = nil
m.Valid = false
if value == nil {
m.Valid = false
return nil
}
macaddrAsBytes, ok := value.([]byte)
if !ok {
return errors.New("could not convert scanned value to bytes")
}
parsedMacaddr, parseErr := net.ParseMAC(string(macaddrAsBytes))
if parseErr != nil {
return parseErr
}
m.Valid = true
m.Macaddr = parsedMacaddr
return nil
}
// Value implements the driver Valuer interface. Note if m.Valid is false
// or m.Macaddr is nil the database column value will be set to NULL.
func (m Macaddr) Value() (driver.Value, error) {
if !m.Valid || m.Macaddr == nil {
return nil, nil
}
return []byte(m.Macaddr.String()), nil
}