Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTreeNode ¶
type FileTreeNode struct {
// Base parameters of files and folders.
Name string
Size int
HashSum hash.FileHash
// Flags.
IsRoot bool
IsDirectory bool
IsFile bool
// Links to other nodes.
Parent *FileTreeNode
Children []*FileTreeNode
}
FileTreeNode is a file tree node used in BitTorrent file of Version 2.
func (*FileTreeNode) AppendChild ¶
func (ftn *FileTreeNode) AppendChild(childNode *FileTreeNode)
AppendChild adds a child node to the parent node.
type NodeRoute ¶
type NodeRoute []*FileTreeNode
NodeRoute is a routed chain of file tree nodes used in BitTorrent file of Version 2. The route starts from the root node and ends with the file node.
func NewNodeRoute ¶
func NewNodeRoute(rootNode *FileTreeNode) (nr NodeRoute)
NewNodeRoute creates a new route of nodes.
func (*NodeRoute) AddNode ¶
func (nr *NodeRoute) AddNode(node *FileTreeNode)
AddNode adds a node to the end of the route.
func (*NodeRoute) ConvertToPath ¶
ConvertToPath composes an array of path elements from a route. Due to the specifics of how the 'name' section is used in BitTorrent files of version 2, we must ignore the root node and process its value later in order to avoid duplicate names in the path.
func (*NodeRoute) RemoveNode ¶
func (nr *NodeRoute) RemoveNode()
RemoveNode removes a node from the end of the route.