mirror of
https://github.com/netbirdio/netbird.git
synced 2024-12-15 19:31:06 +01:00
27 lines
542 B
Go
27 lines
542 B
Go
|
package android
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// DNSList is a wrapper of []string
|
||
|
type DNSList struct {
|
||
|
items []string
|
||
|
}
|
||
|
|
||
|
// Add new DNS address to the collection
|
||
|
func (array *DNSList) Add(s string) {
|
||
|
array.items = append(array.items, s)
|
||
|
}
|
||
|
|
||
|
// Get return an element of the collection
|
||
|
func (array *DNSList) Get(i int) (string, error) {
|
||
|
if i >= len(array.items) || i < 0 {
|
||
|
return "", fmt.Errorf("out of range")
|
||
|
}
|
||
|
return array.items[i], nil
|
||
|
}
|
||
|
|
||
|
// Size return with the size of the collection
|
||
|
func (array *DNSList) Size() int {
|
||
|
return len(array.items)
|
||
|
}
|