1
0
Fork 0
forked from External/grumble

Run go fmt and goimports on all files, to make them follow Golang standards

This commit is contained in:
Ola Bini 2019-12-20 22:51:21 +00:00
parent 4a90b31d8d
commit 76138f47fd
No known key found for this signature in database
GPG key ID: 6786A150F6A2B28F
15 changed files with 47 additions and 32 deletions

View file

@ -6,6 +6,7 @@ package main
import ( import (
"encoding/hex" "encoding/hex"
"mumble.info/grumble/pkg/acl" "mumble.info/grumble/pkg/acl"
) )

View file

@ -10,16 +10,17 @@ import (
"crypto/tls" "crypto/tls"
"encoding/binary" "encoding/binary"
"errors" "errors"
"github.com/golang/protobuf/proto"
"io" "io"
"log" "log"
"net"
"runtime"
"time"
"github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/acl" "mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/cryptstate" "mumble.info/grumble/pkg/cryptstate"
"mumble.info/grumble/pkg/mumbleproto" "mumble.info/grumble/pkg/mumbleproto"
"mumble.info/grumble/pkg/packetdata" "mumble.info/grumble/pkg/packetdata"
"net"
"runtime"
"time"
) )
// A client connection // A client connection

View file

@ -6,19 +6,20 @@ package main
import ( import (
"errors" "errors"
"github.com/golang/protobuf/proto"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
"os"
"path/filepath"
"strconv"
"time"
"github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/acl" "mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/ban" "mumble.info/grumble/pkg/ban"
"mumble.info/grumble/pkg/freezer" "mumble.info/grumble/pkg/freezer"
"mumble.info/grumble/pkg/mumbleproto" "mumble.info/grumble/pkg/mumbleproto"
"mumble.info/grumble/pkg/serverconf" "mumble.info/grumble/pkg/serverconf"
"os"
"path/filepath"
"strconv"
"time"
) )
// Freeze a server to disk and closes the log file. // Freeze a server to disk and closes the log file.

View file

@ -7,11 +7,12 @@
package main package main
import ( import (
"github.com/golang/protobuf/proto"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"github.com/golang/protobuf/proto"
) )
func (server *Server) freezeToFile() (err error) { func (server *Server) freezeToFile() (err error) {

View file

@ -5,12 +5,13 @@
package main package main
import ( import (
"github.com/golang/protobuf/proto"
"io/ioutil" "io/ioutil"
"mumble.info/grumble/pkg/replacefile"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/replacefile"
) )
func (server *Server) freezeToFile() (err error) { func (server *Server) freezeToFile() (err error) {

View file

@ -8,11 +8,12 @@ import (
"flag" "flag"
"fmt" "fmt"
"log" "log"
"mumble.info/grumble/pkg/blobstore"
"mumble.info/grumble/pkg/logtarget"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"mumble.info/grumble/pkg/blobstore"
"mumble.info/grumble/pkg/logtarget"
) )
var servers map[int64]*Server var servers map[int64]*Server

View file

@ -8,13 +8,14 @@ import (
"crypto/aes" "crypto/aes"
"crypto/tls" "crypto/tls"
"fmt" "fmt"
"net"
"time"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/acl" "mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/ban" "mumble.info/grumble/pkg/ban"
"mumble.info/grumble/pkg/freezer" "mumble.info/grumble/pkg/freezer"
"mumble.info/grumble/pkg/mumbleproto" "mumble.info/grumble/pkg/mumbleproto"
"net"
"time"
) )
type Message struct { type Message struct {

View file

@ -13,12 +13,13 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"log" "log"
"mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/ban"
"net" "net"
"os" "os"
"path/filepath" "path/filepath"
"strconv" "strconv"
"mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/ban"
) )
const ( const (

View file

@ -15,9 +15,16 @@ import (
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt" "fmt"
"github.com/golang/protobuf/proto"
"hash" "hash"
"log" "log"
"net"
"net/http"
"path/filepath"
"strings"
"sync"
"time"
"github.com/golang/protobuf/proto"
"mumble.info/grumble/pkg/acl" "mumble.info/grumble/pkg/acl"
"mumble.info/grumble/pkg/ban" "mumble.info/grumble/pkg/ban"
"mumble.info/grumble/pkg/freezer" "mumble.info/grumble/pkg/freezer"
@ -27,12 +34,6 @@ import (
"mumble.info/grumble/pkg/serverconf" "mumble.info/grumble/pkg/serverconf"
"mumble.info/grumble/pkg/sessionpool" "mumble.info/grumble/pkg/sessionpool"
"mumble.info/grumble/pkg/web" "mumble.info/grumble/pkg/web"
"net"
"net/http"
"path/filepath"
"strings"
"sync"
"time"
) )
// The default port a Murmur server listens on // The default port a Murmur server listens on
@ -1452,9 +1453,9 @@ func (server *Server) Start() (err error) {
// Set sensible timeouts, in case no reverse proxy is in front of Grumble. // Set sensible timeouts, in case no reverse proxy is in front of Grumble.
// Non-conforming (or malicious) clients may otherwise block indefinitely and cause // Non-conforming (or malicious) clients may otherwise block indefinitely and cause
// file descriptors (or handles, depending on your OS) to leak and/or be exhausted // file descriptors (or handles, depending on your OS) to leak and/or be exhausted
ReadTimeout: 5 * time.Second, ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second,
IdleTimeout: 2 * time.Minute, IdleTimeout: 2 * time.Minute,
} }
go func() { go func() {
err := server.webhttp.ListenAndServeTLS("", "") err := server.webhttp.ListenAndServeTLS("", "")

View file

@ -8,10 +8,11 @@ package main
import ( import (
"fmt" "fmt"
"mumble.info/grumble/pkg/logtarget"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"mumble.info/grumble/pkg/logtarget"
) )
func SignalHandler() { func SignalHandler() {

View file

@ -7,6 +7,7 @@ package cryptstate
import ( import (
"crypto/aes" "crypto/aes"
"crypto/cipher" "crypto/cipher"
"mumble.info/grumble/pkg/cryptstate/ocb2" "mumble.info/grumble/pkg/cryptstate/ocb2"
) )

View file

@ -5,8 +5,9 @@
package cryptstate package cryptstate
import ( import (
"golang.org/x/crypto/nacl/secretbox"
"unsafe" "unsafe"
"golang.org/x/crypto/nacl/secretbox"
) )
// secretBoxMode implements the XSalsa20-Poly1305 CryptoMode // secretBoxMode implements the XSalsa20-Poly1305 CryptoMode

View file

@ -7,12 +7,13 @@ package freezer
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"github.com/golang/protobuf/proto"
"hash/crc32" "hash/crc32"
"io" "io"
"math" "math"
"os" "os"
"testing" "testing"
"github.com/golang/protobuf/proto"
) )
var testValues []proto.Message = []proto.Message{ var testValues []proto.Message = []proto.Message{

View file

@ -6,11 +6,12 @@ package freezer
import ( import (
"encoding/binary" "encoding/binary"
"github.com/golang/protobuf/proto"
"hash" "hash"
"hash/crc32" "hash/crc32"
"io" "io"
"math" "math"
"github.com/golang/protobuf/proto"
) )
// Checks whether the error err is an EOF // Checks whether the error err is an EOF

View file

@ -18,12 +18,13 @@ package freezer
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"github.com/golang/protobuf/proto"
"hash" "hash"
"hash/crc32" "hash/crc32"
"io" "io"
"math" "math"
"os" "os"
"github.com/golang/protobuf/proto"
) )
// Log implements an append-only log for flattened // Log implements an append-only log for flattened