func (t *ipTree) setRight(child *ipTree) {
	if t.right != nil && t == t.right.up {
		t.right.up = nil
	}
	t.right = child
	if child != nil {
		child.up = t
	}
}
setRight helps maintain the bidirectional relationships in the tree. Always
use it to set the right child of a node.
package netaddr
import (
	"bytes"
	"errors"
	"math/big"
	"net"
)
type ipTree struct {
	net             *net.IPNet
	left, right, up *ipTree
}
func (t *ipTree) setLeft(child *ipTree) {
	if t.left != nil && t == t.left.up {
		t.left.up = nil
	}
	t.left = child
	if child != nil {
		child.up = t
	}
}