some doco updates
This commit is contained in:
11
README.md
11
README.md
@@ -4,14 +4,14 @@ A self-hosted Real-Debrid webdav server written from scratch. Together with [rcl
|
||||
|
||||
## Download
|
||||
|
||||
### Latest version: v0.9.3
|
||||
### Latest version: v0.9.3-hotfix.2
|
||||
|
||||
[Download the binary](https://github.com/debridmediamanager/zurg-testing/tree/main/releases/v0.9.3) or use docker
|
||||
[Download the binary](https://github.com/debridmediamanager/zurg-testing/tree/main/releases/v0.9.3-hotfix.2) or use docker
|
||||
|
||||
```sh
|
||||
docker pull ghcr.io/debridmediamanager/zurg-testing:latest
|
||||
# or
|
||||
docker pull ghcr.io/debridmediamanager/zurg-testing:v0.9.3
|
||||
docker pull ghcr.io/debridmediamanager/zurg-testing:v0.9.3-hotfix.2
|
||||
```
|
||||
|
||||
## How to run zurg in 5 steps for Plex with Docker
|
||||
@@ -61,6 +61,11 @@ Use "zurg [command] --help" for more information about a command.
|
||||
- [@Pukabyte](https://github.com/Pukabyte) - [Guide: Zurg + RDT + Prowlarr + Arrs + Petio + Autoscan + Plex + Scannarr](https://puksthepirate.notion.site/Guide-Zurg-RDT-Prowlarr-Arrs-Petio-Autoscan-Plex-Scannarr-eebe27d130fa400c8a0536cab9d46eb3)
|
||||
- [u/pg988](https://www.reddit.com/user/pg988/) - [Windows + zurg + Plex guide](https://www.reddit.com/r/RealDebrid/comments/18so926/windows_zurg_plex_guide/)
|
||||
- [@ignamiranda](https://github.com/ignamiranda) - [Plex Debrid Zurg Windows Guide](https://github.com/ignamiranda/plex_debrid_zurg_scripts/)
|
||||
- [@funkypenguin](https://github.com/funkypenguin) - ["Infinite streaming" from Real Debrid with Plex](https://elfhosted.com/guides/media/stream-from-real-debrid-with-plex/) (ElfHosted)
|
||||
|
||||
## Service Providers
|
||||
|
||||
- [ElfHosted](https://elfhosted.com) - Easy, [open source](https://elfhosted.com/open/), Kubernetes / GitOps driven hosting of popular self-hosted apps - tested, tightly integrated, and secured. Apps start at $0.05/day, and new accounts get $10 credit, no commitment.
|
||||
|
||||
## Please read our [wiki](https://github.com/debridmediamanager/zurg-testing/wiki) for more information!
|
||||
|
||||
|
||||
65
pkg/utils/ipaddress.go
Normal file
65
pkg/utils/ipaddress.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
// IPVersion specifies the IP version (IPv4 or IPv6).
|
||||
type IPVersion int
|
||||
|
||||
const (
|
||||
IPv4 IPVersion = 4
|
||||
IPv6 IPVersion = 6
|
||||
)
|
||||
|
||||
// fetchWebpage fetches the content of a URL and returns it as a string.
|
||||
// It uses the specified IP version for the HTTP request.
|
||||
func fetchWebpage(url string, version IPVersion) string {
|
||||
client := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
DialContext: (&net.Dialer{}).DialContext,
|
||||
Dial: func(network, addr string) (net.Conn, error) {
|
||||
if version == IPv6 {
|
||||
addr = "[" + addr + "]"
|
||||
}
|
||||
return net.Dial(network, addr)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := client.Get(url)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return string(body)
|
||||
}
|
||||
|
||||
// extractIPAddress extracts the IP address from the given string.
|
||||
func extractIPAddress(input string) string {
|
||||
re := regexp.MustCompile(`(?m)Your IP Address:</strong> ([^<]+)`)
|
||||
matches := re.FindStringSubmatch(input)
|
||||
if len(matches) < 1 {
|
||||
return ""
|
||||
}
|
||||
return matches[0]
|
||||
}
|
||||
|
||||
// GetPublicIPAddress returns the public IP address of the machine.
|
||||
func GetPublicIPAddress() (string, string) {
|
||||
ipv4 := fetchWebpage("https://real-debrid.com/vpn", IPv4)
|
||||
ipv4address := extractIPAddress(ipv4)
|
||||
ipv6 := fetchWebpage("https://real-debrid.com/vpn", IPv6)
|
||||
ipv6address := extractIPAddress(ipv6)
|
||||
|
||||
return ipv4address, ipv6address
|
||||
}
|
||||
39
repair.md
39
repair.md
@@ -1,39 +0,0 @@
|
||||
## Repair Functionality in Zurg's Torrent Management
|
||||
|
||||
The repair functionality in Zurg's torrent management tool seems to be designed to ensure that all selected files within a torrent are available. If they aren't, the system will attempt to repair the torrent, ensuring that users can access all the files they expect. Here's a breakdown of the logic:
|
||||
|
||||
### Repair Triggers:
|
||||
|
||||
1. **Unrestricting a Link Failure:** If the system fails to unrestrict a link, and the file isn't already marked as unavailable, Zurg will mark the file as unavailable and attempt to repair the torrent.
|
||||
|
||||
2. **After All Other Operations:** After all other concurrent operations (wait group based), Zurg checks every torrent to see if it needs repair. Torrents marked for repair are addressed, and torrents with 100% progress but no links are deleted.
|
||||
|
||||
3. **File Link Mismatch:** If the number of selected files is greater than the number of links, and the torrent progress is 100%, the system will either:
|
||||
- Organize the files if the torrent is "chaotic".
|
||||
- Mark the torrent for repair if more than one streamable file is available.
|
||||
- Ignore the torrent if only one streamable link is expired.
|
||||
|
||||
### Repair Process:
|
||||
|
||||
1. **Preliminary Checks:**
|
||||
- If the torrent is already being repaired, the function will skip the current repair attempt.
|
||||
- If the torrent has already been repaired, i.e., all missing or unavailable files have been found with different links, the function returns without making further repair attempts.
|
||||
|
||||
2. **Repair Strategies:**
|
||||
- **Reinsertion:** The primary strategy to repair a torrent is to try reinserting it, hoping that reinserting can fix the missing links. If this succeeds, the repair is considered successful.
|
||||
- **Redownload with Additional File:** If all selected files or just one is missing but there are other streamable files available, one extra streamable file is downloaded. This action forces a redownload of the missing files or prevents a rename if there's only one missing file.
|
||||
- **Redownload in Batches:** If reinsertion with an extra file doesn't work, and there's more than one selected file, the missing files are divided into two batches, and each batch is reinserted separately.
|
||||
|
||||
3. **Inability to Repair:** If neither reinsertion strategy works, and only one file is selected, the system logs that the torrent cannot be repaired.
|
||||
|
||||
### Functions Used:
|
||||
|
||||
- **unrestrictFn:** This function attempts to unrestrict a link using the `realdebrid.UnrestrictLink` method.
|
||||
|
||||
- **HideTheFile:** If a file is unavailable, this method marks it as such and triggers a repair for the torrent.
|
||||
|
||||
- **repairAll:** After all other concurrent operations, this method iterates through torrents and repairs the ones marked for repair or deletes torrents that are 100% done but have no links.
|
||||
|
||||
- **repair:** This is the main function that handles the repair logic for a given torrent. It checks whether a torrent is already being repaired or has been repaired and then attempts various strategies to repair it if needed.
|
||||
|
||||
This system seems to prioritize user experience by ensuring that all selected files are accessible. If the system can't ensure that, it takes steps to make them available, either by reinserting the torrent or by forcing redownloads.
|
||||
Reference in New Issue
Block a user