// Initialize the network stack. Multiple calls lead to a stack panic. func Initialize(flags LWIPStackFlag) { if stack != nil { panic("LWIPv6 already initialized.") } // Initialize LWIPv6 C.lwip_init() // Setup the default network stack stack = C.lwip_add_stack(C.ulong(flags)) C.lwip_stack_set(stack) }
// Finalizes and closes down the stack. This should only be done after all // network operatons are finished. func Finish() { C.lwip_stack_set(nil) C.lwip_del_stack(stack) stack = nil C.lwip_fini() }