MakeAPIBootConfiguration creates a new APIBootConfiguration initialized with provided values
(url string, timeout time.Duration, preference uint8, usePreference bool, dnsServerAddresses []net.IP)
| 63 | |
| 64 | // MakeAPIBootConfiguration creates a new APIBootConfiguration initialized with provided values |
| 65 | func MakeAPIBootConfiguration(url string, timeout time.Duration, preference uint8, usePreference bool, |
| 66 | dnsServerAddresses []net.IP) *APIBootConfiguration { |
| 67 | if !strings.HasSuffix(url, "/") { |
| 68 | url += "/" |
| 69 | } |
| 70 | ret := &APIBootConfiguration{ |
| 71 | Client: &http.Client{Timeout: timeout}, |
| 72 | URLPrefix: url + "v1", |
| 73 | UsePreference: usePreference, |
| 74 | } |
| 75 | if usePreference { |
| 76 | ret.Preference = make([]byte, 1) |
| 77 | ret.Preference[0] = preference |
| 78 | } |
| 79 | ret.RecursiveDNS = dnsServerAddresses |
| 80 | |
| 81 | return ret |
| 82 | } |
| 83 | |
| 84 | // GetBootURL returns Boot File URL, see RFC 5970 |
| 85 | func (bc *APIBootConfiguration) GetBootURL(id []byte, clientArchType uint16) ([]byte, error) { |