package unipede import ( "net/http" "strings" ) type ( UpARPView struct { Count int `json:"count" bson:"count"` Errors []*Error `json:"errors" bson:"errors"` Items []*ARPView `json:"items" bson:"items"` Links map[string]Links `json:"links" bson:"links"` } ARPView struct { Address string `json:"address" bson:"address"` Age string `json:"age" bson:"age"` Created string `json:"created" bson:"created"` EntryType string `json:"entrytype" bson:"entrytype"` Id int `json:"id" bson:"id"` Interface string `json:"interface" bson:"interface"` MAC string `json:"mac" bson:"mac"` UpDeviceId int `json:"up_device_id" bson:"up_device_id"` Updated string `json:"updated" bson:"updated"` } ) func (u *Client) UpARP(switchName, ipFilter string, refresh *int, options ...*UnipedeOptions) (*UpARPView, error) { if ipFilter != "" { } o := processOptions(refresh, nil, options...) req, err := u.newRequest(unipedeURL+"devices/"+switchName+"/UpARP::View", http.MethodGet, o, nil) if err != nil { return nil, err } swconf := new(UpARPView) _, err = u.do(req, o, swconf) return swconf, err } func (u *UpARPView) FindAddress(addr string) *ARPView { for _, i := range u.Items { if i.Address == addr { return i } } return nil } func (u *UpARPView) FindMAC(addr string) *ARPView { addr = strings.ToLower(addr) for _, i := range u.Items { if strings.ToLower(i.MAC) == addr { return i } } return nil }