NewGenWithOptions returns a new instance of Gen with the options provided. Most people should use NewGen() or NewGenWithHWAF() instead. To customize the generator, you can pass in one or more GenOption functions. For example: gen := NewGenWithOptions( WithHWAddrFunc(myHWAddrFunc), WithE
(opts ...GenOption)
| 179 | // NewGenWithHWAF(myHWAddrFunc) |
| 180 | // NewGenWithOptions() is equivalent to calling NewGen() |
| 181 | func NewGenWithOptions(opts ...GenOption) *Gen { |
| 182 | gen := &Gen{ |
| 183 | epochFunc: time.Now, |
| 184 | hwAddrFunc: defaultHWAddrFunc, |
| 185 | rand: rand.Reader, |
| 186 | } |
| 187 | |
| 188 | for _, opt := range opts { |
| 189 | opt(gen) |
| 190 | } |
| 191 | |
| 192 | return gen |
| 193 | } |
| 194 | |
| 195 | // WithHWAddrFunc is a GenOption that allows you to provide your own HWAddrFunc |
| 196 | // function. |
no outgoing calls