-
Notifications
You must be signed in to change notification settings - Fork 0
/
tree.go
35 lines (29 loc) · 968 Bytes
/
tree.go
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
33
34
35
package go_basic_radix_tree
// RadixNode represents a node in the radix tree
type RadixNode struct {
Key []byte
Children *RadixNode
}
// RadixTree represents the radix tree structure
type RadixTree struct {
Root *RadixNode
}
// NewRadixTree creates a new instance of a RadixTree
func NewRadixTree() *RadixTree {
return nil
}
// convertIPtoIPv6 takes an IP address string and returns its IPv6 byte representation.
// If the IP is already IPv6, it's returned as is. If it's IPv4, it's converted to IPv6.
func convertIPtoIPv6(ipStr string) ([]byte, error) {
return nil, nil
}
// Insert adds a new IP address to the radix tree.
// The IP address is first converted to its IPv6 byte representation.
func (t *RadixTree) Insert(ipStr string) error {
return nil
}
// Query checks if an IP address exists in the radix tree.
// Returns true if the IP address exists, false otherwise.
func (t *RadixTree) Query(ipStr string) (bool, error) {
return false, nil
}