// SearchExact searches radix tree to find a matching node. Its semantics are the same as in SearchBest() // method except that the addr must match a node exactly. func (rtree *NetRadixTree) SearchExact(addr string) (found bool, udata string, err error) { var prefix C.prefix_t e := rtree.fillPrefix(&prefix, addr) if e != nil { return false, "", e } node := C.radix_search_exact(rtree.tree, &prefix) if node != nil { return true, C.GoString((*C.char)(node.data)), nil } return false, "", nil }
// SearchExact searches radix tree to find a matching node. Its semantics are the same as in SearchBest() // method except that the addr must match a node exactly. func (rtree *NetRadixTree) SearchExact(addr string) (found bool, udata unsafe.Pointer, err error) { var prefix C.prefix_t e := rtree.fillPrefix(&prefix, addr) if e != nil { return false, nil, e } node := C.radix_search_exact(rtree.tree, &prefix) if node != nil { return true, node.data, nil } return false, nil, nil }
// Remove deletes a node which exactly matches the address given. // If no errors occured returns nil or error object otherwise. func (rtree *NetRadixTree) Remove(addr string) error { var prefix C.prefix_t err := rtree.fillPrefix(&prefix, addr) if err != nil { return err } node := C.radix_search_exact(rtree.tree, &prefix) if node != nil { C.free(unsafe.Pointer(node.data)) C.radix_remove(rtree.tree, node) } return nil }