mirror of https://github.com/tgragnato/magnetico
chore(module): migrate to v2 module structure and update import paths
This commit is contained in:
parent
73e0b4b1c2
commit
277dfacde7
|
|
@ -8,7 +8,7 @@ import (
|
|||
"regexp"
|
||||
|
||||
"github.com/bits-and-blooms/bloom/v3"
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
type Message struct {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
var codecTest_validInstances = []struct {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
type IndexingService struct {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
type Protocol struct {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strconv"
|
||||
"sync"
|
||||
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
type routingTable struct {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package dht
|
|||
import (
|
||||
"net"
|
||||
|
||||
"tgragnato.it/magnetico/dht/mainline"
|
||||
"tgragnato.it/magnetico/v2/dht/mainline"
|
||||
)
|
||||
|
||||
type Service interface {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/dht/mainline"
|
||||
"tgragnato.it/magnetico/v2/dht/mainline"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
2
go.mod
2
go.mod
|
|
@ -1,4 +1,4 @@
|
|||
module tgragnato.it/magnetico
|
||||
module tgragnato.it/magnetico/v2
|
||||
|
||||
go 1.23.6
|
||||
|
||||
|
|
|
|||
14
main.go
14
main.go
|
|
@ -7,13 +7,13 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/dht"
|
||||
"tgragnato.it/magnetico/dht/mainline"
|
||||
"tgragnato.it/magnetico/metadata"
|
||||
"tgragnato.it/magnetico/opflags"
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/web"
|
||||
"tgragnato.it/magnetico/v2/dht"
|
||||
"tgragnato.it/magnetico/v2/dht/mainline"
|
||||
"tgragnato.it/magnetico/v2/metadata"
|
||||
"tgragnato.it/magnetico/v2/opflags"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
"tgragnato.it/magnetico/v2/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import (
|
|||
"net"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/metadata/btconn"
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
"tgragnato.it/magnetico/v2/metadata/btconn"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
const MAX_METADATA_SIZE = 10 * 1024 * 1024
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
func TestDecoder(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"net"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/dht"
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/dht"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ import (
|
|||
mrand "math/rand/v2"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/metainfo"
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
"tgragnato.it/magnetico/v2/metainfo"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
func totalSize(files []persistence.File) (uint64, error) {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/metainfo"
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
"tgragnato.it/magnetico/v2/metainfo"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
func TestTotalSize(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"tgragnato.it/magnetico/merkle"
|
||||
"tgragnato.it/magnetico/v2/merkle"
|
||||
)
|
||||
|
||||
func ValidatePieceLayers(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"errors"
|
||||
"sort"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
const FileTreePropertiesKey = ""
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package metainfo_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/metainfo"
|
||||
"tgragnato.it/magnetico/v2/metainfo"
|
||||
)
|
||||
|
||||
func TestFileInfo_DisplayPath(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
func Fuzz(f *testing.F) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package metainfo
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
func TestMarshalInfo(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/multiformats/go-multihash"
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/types/infohash-v2"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/v2/types/infohash-v2"
|
||||
)
|
||||
|
||||
// Magnet link components.
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import (
|
|||
"net/url"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/types/infohash-v2"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/v2/types/infohash-v2"
|
||||
)
|
||||
|
||||
func TestParseMagnetV2(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
)
|
||||
|
||||
// Magnet link components.
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/types/infohash-v2"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/v2/types/infohash-v2"
|
||||
)
|
||||
|
||||
// Also known as a torrent file.
|
||||
|
|
@ -75,7 +75,7 @@ func (mi *MetaInfo) Write(w io.Writer) error {
|
|||
|
||||
// Set good default values in preparation for creating a new MetaInfo file.
|
||||
func (mi *MetaInfo) SetDefaults() {
|
||||
mi.CreatedBy = "tgragnato.it/magnetico"
|
||||
mi.CreatedBy = "tgragnato.it/magnetico/v2"
|
||||
mi.CreationDate = time.Now().Unix()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
func testFile(t *testing.T, filename string) {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net"
|
||||
"strconv"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
type Node string
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
func testFileNodesMatch(t *testing.T, file string, nodes []Node) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package metainfo
|
||||
|
||||
import "tgragnato.it/magnetico/types/infohash"
|
||||
import "tgragnato.it/magnetico/v2/types/infohash"
|
||||
|
||||
type Piece struct {
|
||||
Info *Info
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package metainfo
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
)
|
||||
|
||||
func TestPiece_Length(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package metainfo
|
||||
|
||||
import (
|
||||
"tgragnato.it/magnetico/bencode"
|
||||
"tgragnato.it/magnetico/v2/bencode"
|
||||
)
|
||||
|
||||
type UrlList []string
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import (
|
|||
|
||||
_ "github.com/jackc/pgx/v5"
|
||||
_ "github.com/jackc/pgx/v5/stdlib"
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
)
|
||||
|
||||
type postgresDatabase struct {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/multiformats/go-multihash"
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
)
|
||||
|
||||
const Size = sha256.Size
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
)
|
||||
|
||||
func TestT_Format(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
type Feed struct {
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/stats"
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/types/infohash-v2"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
"tgragnato.it/magnetico/v2/stats"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
infohash_v2 "tgragnato.it/magnetico/v2/types/infohash-v2"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
func TestInfohashMiddleware(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/types/infohash"
|
||||
"tgragnato.it/magnetico/v2/types/infohash"
|
||||
)
|
||||
|
||||
func TestTorrent(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
g "maragu.dev/gomponents"
|
||||
c "maragu.dev/gomponents/components"
|
||||
. "maragu.dev/gomponents/html"
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
func torrents() g.Node {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"tgragnato.it/magnetico/persistence"
|
||||
"tgragnato.it/magnetico/v2/persistence"
|
||||
)
|
||||
|
||||
func TestTorrents(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue