mirror of
https://github.com/sot-tech/mochi.git
synced 2026-06-09 22:43:32 -07:00
Remove YAML/MD lint configs, reformat stdlib imports
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
---
|
||||
line-length: false
|
||||
no-hard-tabs: false
|
||||
@@ -1,11 +0,0 @@
|
||||
# vim: ft=yaml
|
||||
---
|
||||
yaml-files:
|
||||
- "*.yaml"
|
||||
- "*.yml"
|
||||
- ".yamllint"
|
||||
ignore: "dist/helm/"
|
||||
extends: "default"
|
||||
rules:
|
||||
quoted-strings: "enable"
|
||||
line-length: "disable"
|
||||
@@ -8,10 +8,11 @@ import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sot-tech/mochi/pkg/log"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sot-tech/mochi/pkg/log"
|
||||
)
|
||||
|
||||
// PeerIDLen is length of peer id field in bytes
|
||||
|
||||
+5
-4
@@ -3,6 +3,11 @@ package main
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/sot-tech/mochi/frontend/http"
|
||||
"github.com/sot-tech/mochi/frontend/udp"
|
||||
@@ -13,10 +18,6 @@ import (
|
||||
"github.com/sot-tech/mochi/pkg/stop"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"github.com/spf13/cobra"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var e2eCmd *cobra.Command
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build darwin || freebsd || linux || netbsd || openbsd || dragonfly || solaris
|
||||
// +build darwin freebsd linux netbsd openbsd dragonfly solaris
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package main
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ package http
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/anacrolix/torrent/bencode"
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/pkg/log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// WriteError communicates an error to a BitTorrent client over HTTP.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package clientapproval
|
||||
|
||||
import (
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
)
|
||||
|
||||
func TestClientID(t *testing.T) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/middleware"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
|
||||
@@ -3,9 +3,10 @@ package clientapproval
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var cases = []struct {
|
||||
|
||||
@@ -3,6 +3,7 @@ package middleware
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
)
|
||||
|
||||
@@ -13,6 +13,10 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
jc "github.com/SermoDigital/jose/crypto"
|
||||
"github.com/SermoDigital/jose/jws"
|
||||
"github.com/SermoDigital/jose/jwt"
|
||||
@@ -23,9 +27,6 @@ import (
|
||||
"github.com/sot-tech/mochi/pkg/stop"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"gopkg.in/yaml.v3"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Name is the name by which this middleware is registered with Conf.
|
||||
|
||||
+2
-1
@@ -2,12 +2,13 @@ package middleware
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/frontend"
|
||||
"github.com/sot-tech/mochi/pkg/log"
|
||||
"github.com/sot-tech/mochi/pkg/stop"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ResponseConfig holds the configuration used for the actual response.
|
||||
|
||||
@@ -4,9 +4,10 @@ package middleware
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"gopkg.in/yaml.v3"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package random
|
||||
|
||||
import (
|
||||
_ "github.com/sot-tech/mochi/pkg/rand_seed"
|
||||
"github.com/stretchr/testify/require"
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
_ "github.com/sot-tech/mochi/pkg/rand_seed"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntn(t *testing.T) {
|
||||
|
||||
@@ -2,9 +2,10 @@ package container
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// DefaultStorageCtxName default ctx name if value from configuration is not set
|
||||
|
||||
@@ -6,6 +6,7 @@ package directory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/anacrolix/torrent/metainfo"
|
||||
"github.com/anacrolix/torrent/util/dirwatch"
|
||||
"github.com/minio/sha256-simd"
|
||||
|
||||
@@ -4,6 +4,7 @@ package list
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/middleware/torrentapproval/container"
|
||||
"github.com/sot-tech/mochi/pkg/log"
|
||||
|
||||
@@ -5,6 +5,7 @@ package torrentapproval
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/middleware"
|
||||
"github.com/sot-tech/mochi/middleware/torrentapproval/container"
|
||||
|
||||
@@ -3,11 +3,12 @@ package torrentapproval
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/storage/memory"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/yaml.v3"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var cases = []struct {
|
||||
|
||||
@@ -4,13 +4,14 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/middleware"
|
||||
"github.com/sot-tech/mochi/middleware/pkg/random"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"gopkg.in/yaml.v3"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Name is the name by which this middleware is registered with Conf.
|
||||
|
||||
@@ -3,9 +3,10 @@ package varinterval
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var configTests = []struct {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package memory
|
||||
|
||||
import (
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"github.com/sot-tech/mochi/storage/test"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"github.com/sot-tech/mochi/storage/test"
|
||||
)
|
||||
|
||||
func createNew() storage.Storage {
|
||||
|
||||
+2
-1
@@ -2,8 +2,9 @@ package storage
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"net"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
)
|
||||
|
||||
// Pair - some key-value pair, used for BulkPut
|
||||
|
||||
@@ -3,13 +3,14 @@ package redis
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/go-redsync/redsync/v4"
|
||||
"github.com/go-redsync/redsync/v4/redis/redigo"
|
||||
redigolib "github.com/gomodule/redigo/redis"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-redsync/redsync/v4"
|
||||
"github.com/go-redsync/redsync/v4/redis/redigo"
|
||||
redigolib "github.com/gomodule/redigo/redis"
|
||||
)
|
||||
|
||||
// redisBackend represents a redis handler.
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/pkg/rand_seed"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"math/rand"
|
||||
"net"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/pkg/rand_seed"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
)
|
||||
|
||||
type benchData struct {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"github.com/sot-tech/mochi/storage"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// PeerEqualityFunc is the boolean function to use to check two Peers for
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
"net"
|
||||
|
||||
"github.com/sot-tech/mochi/bittorrent"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user