File: option_bootfileurl.go

package info (click to toggle)
golang-github-insomniacslk-dhcp 0.0~git20200621.d74cd86-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,132 kB
  • sloc: makefile: 9
file content (32 lines) | stat: -rw-r--r-- 802 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package dhcpv6

import (
	"fmt"
)

// OptBootFileURL returns a OptionBootfileURL as defined by RFC 5970.
func OptBootFileURL(url string) Option {
	return optBootFileURL(url)
}

type optBootFileURL string

// Code returns the option code
func (op optBootFileURL) Code() OptionCode {
	return OptionBootfileURL
}

// ToBytes serializes the option and returns it as a sequence of bytes
func (op optBootFileURL) ToBytes() []byte {
	return []byte(op)
}

func (op optBootFileURL) String() string {
	return fmt.Sprintf("BootFileURL: %s", string(op))
}

// parseOptBootFileURL builds an optBootFileURL structure from a sequence
// of bytes. The input data does not include option code and length bytes.
func parseOptBootFileURL(data []byte) (optBootFileURL, error) {
	return optBootFileURL(string(data)), nil
}