Random access for RARed RealDebrid torrents (#61)
* feat: AI translated port of RARAR.py in Go * feat: Extract and cache byte ranges of RARed RD torrents * feat: Stream and download files with byte ranges if specified * refactor: Use a more structured data format for byte ranges * fix: Rework streaming to fix error handling * perf: More efficient RAR file pre-processing * feat: Made the RAR unpacker an optional config option * refactor: Remove unnecessary Rar prefix for more idiomatic code * refactor: More appropriate private method declaration * feat: Error handling for parsing RARed torrents with retry requests and EOF validation * fix: Correctly parse unicode file names * fix: Handle special character conversion for RAR torrent file names * refactor: Removed debug logs * feat: Only allow two concurrent RAR unpacking tasks * fix: Include "<" and ">" as unsafe chars for RAR unpacking * refactor: Seperate types into their own file * refactor: Don't read RAR files on reader initialization
This commit is contained in:
committed by
GitHub
parent
7f25599b60
commit
fbd6cd5038
37
pkg/rar/types.go
Normal file
37
pkg/rar/types.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package rar
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// File represents a file entry in a RAR archive
|
||||
type File struct {
|
||||
Path string
|
||||
Size int64
|
||||
CompressedSize int64
|
||||
Method byte
|
||||
CRC uint32
|
||||
IsDirectory bool
|
||||
DataOffset int64
|
||||
NextOffset int64
|
||||
}
|
||||
|
||||
// Access point for a RAR archive served through HTTP
|
||||
type HttpFile struct {
|
||||
URL string
|
||||
Position int64
|
||||
Client *http.Client
|
||||
FileSize int64
|
||||
MaxRetries int
|
||||
RetryDelay time.Duration
|
||||
}
|
||||
|
||||
// Reader reads RAR3 format archives
|
||||
type Reader struct {
|
||||
File *HttpFile
|
||||
ChunkSize int
|
||||
Marker int64
|
||||
HeaderEndPos int64 // Position after the archive header
|
||||
Files []*File
|
||||
}
|
||||
Reference in New Issue
Block a user