Pull request: home: imp err handling, marshalling

Merge in DNS/adguard-home from imp-code to master

Squashed commit of the following:

commit 9433fb9b0154a1cfaf804edbfa8531efbbcbf68a
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Fri May 14 19:24:32 2021 +0300

    home: imp err handling, marshalling
This commit is contained in:
Ainar Garipov
2021-05-14 19:41:45 +03:00
parent 9d788a2983
commit a031cae447
6 changed files with 56 additions and 63 deletions

View File

@@ -84,17 +84,17 @@ type NetInterface struct {
Subnets []*net.IPNet `json:"-"`
}
// MarshalJSON implements the json.Marshaler interface for *NetInterface.
func (iface *NetInterface) MarshalJSON() ([]byte, error) {
// MarshalJSON implements the json.Marshaler interface for NetInterface.
func (iface NetInterface) MarshalJSON() ([]byte, error) {
type netInterface NetInterface
return json.Marshal(&struct {
HardwareAddr string `json:"hardware_address"`
Flags string `json:"flags"`
*netInterface
netInterface
}{
HardwareAddr: iface.HardwareAddr.String(),
Flags: iface.Flags.String(),
netInterface: (*netInterface)(iface),
netInterface: netInterface(iface),
})
}