format Go source code.

This commit is contained in:
Miroslav Šedivý 2021-02-14 14:40:17 +01:00
parent 732764991b
commit 45679f1b86
54 changed files with 445 additions and 447 deletions

View File

@ -5,8 +5,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"demodesk/neko" "demodesk/neko"
"demodesk/neko/modules"
"demodesk/neko/internal/config" "demodesk/neko/internal/config"
"demodesk/neko/modules"
) )
func init() { func init() {

View File

@ -3,8 +3,8 @@ package members
import ( import (
"net/http" "net/http"
"demodesk/neko/internal/utils"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils"
) )
type MemberDataPayload struct { type MemberDataPayload struct {

View File

@ -6,9 +6,9 @@ import (
"github.com/go-chi/chi" "github.com/go-chi/chi"
"demodesk/neko/internal/http/auth"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
"demodesk/neko/internal/http/auth"
) )
type key int type key int

View File

@ -3,9 +3,9 @@ package room
import ( import (
"net/http" "net/http"
"demodesk/neko/internal/utils"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/utils"
) )
type BroadcastStatusPayload struct { type BroadcastStatusPayload struct {

View File

@ -6,8 +6,8 @@ import (
//"strings" //"strings"
"net/http" "net/http"
"demodesk/neko/internal/utils"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils"
) )
type ClipboardPayload struct { type ClipboardPayload struct {

View File

@ -5,10 +5,10 @@ import (
"github.com/go-chi/chi" "github.com/go-chi/chi"
"demodesk/neko/internal/http/auth"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
"demodesk/neko/internal/http/auth"
) )
type ControlStatusPayload struct { type ControlStatusPayload struct {

View File

@ -5,8 +5,8 @@ import (
"github.com/go-chi/chi" "github.com/go-chi/chi"
"demodesk/neko/internal/types"
"demodesk/neko/internal/http/auth" "demodesk/neko/internal/http/auth"
"demodesk/neko/internal/types"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
) )

View File

@ -3,8 +3,8 @@ package room
import ( import (
"net/http" "net/http"
"demodesk/neko/internal/utils"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils"
) )
type KeyboardMapData struct { type KeyboardMapData struct {

View File

@ -3,8 +3,8 @@ package room
import ( import (
"bytes" "bytes"
"image/jpeg" "image/jpeg"
"strconv"
"net/http" "net/http"
"strconv"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"

View File

@ -1,12 +1,12 @@
package room package room
import ( import (
"os"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http"
"os"
"path" "path"
"strconv" "strconv"
"net/http"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
) )

View File

@ -7,10 +7,10 @@ import (
"demodesk/neko/internal/api/members" "demodesk/neko/internal/api/members"
"demodesk/neko/internal/api/room" "demodesk/neko/internal/api/room"
"demodesk/neko/internal/config"
"demodesk/neko/internal/http/auth" "demodesk/neko/internal/http/auth"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
"demodesk/neko/internal/config"
) )
type ApiManagerCtx struct { type ApiManagerCtx struct {

View File

@ -1,12 +1,12 @@
package api package api
import ( import (
"time"
"net/http" "net/http"
"time"
"demodesk/neko/internal/utils"
"demodesk/neko/internal/types"
"demodesk/neko/internal/http/auth" "demodesk/neko/internal/http/auth"
"demodesk/neko/internal/types"
"demodesk/neko/internal/utils"
) )
type SessionLoginPayload struct { type SessionLoginPayload struct {

View File

@ -2,8 +2,8 @@ package capture
import ( import (
"fmt" "fmt"
"sync"
"strings" "strings"
"sync"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"

View File

@ -8,8 +8,8 @@ package gst
import "C" import "C"
import ( import (
"fmt" "fmt"
"time"
"sync" "sync"
"time"
"unsafe" "unsafe"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"

View File

@ -7,9 +7,9 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/config"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/codec" "demodesk/neko/internal/types/codec"
"demodesk/neko/internal/config"
) )
type CaptureManagerCtx struct { type CaptureManagerCtx struct {

View File

@ -2,15 +2,15 @@ package capture
import ( import (
"fmt" "fmt"
"time"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/types"
"demodesk/neko/internal/capture/gst" "demodesk/neko/internal/capture/gst"
"demodesk/neko/internal/types"
) )
type ScreencastManagerCtx struct { type ScreencastManagerCtx struct {

View File

@ -2,15 +2,15 @@ package capture
import ( import (
"fmt" "fmt"
"sync"
"reflect" "reflect"
"sync"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/capture/gst"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/codec" "demodesk/neko/internal/types/codec"
"demodesk/neko/internal/capture/gst"
) )
type StreamManagerCtx struct { type StreamManagerCtx struct {

View File

@ -1,8 +1,8 @@
package desktop package desktop
import ( import (
"fmt"
"bytes" "bytes"
"fmt"
"os/exec" "os/exec"
"strings" "strings"

View File

@ -52,7 +52,7 @@ func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) bool {
case succeeded := <-finished: case succeeded := <-finished:
return succeeded return succeeded
case <-time.After(1 * time.Second): case <-time.After(1 * time.Second):
drop.CloseWindow(); drop.CloseWindow()
return false return false
} }
} }

View File

@ -25,7 +25,7 @@ func OpenWindow(files []string) {
defer mu.Unlock() defer mu.Unlock()
size := C.int(len(files)) size := C.int(len(files))
urisUnsafe := C.dragUrisMake(size); urisUnsafe := C.dragUrisMake(size)
defer C.dragUrisFree(urisUnsafe, size) defer C.dragUrisFree(urisUnsafe, size)
for i, file := range files { for i, file := range files {

View File

@ -2,8 +2,8 @@ package desktop
import ( import (
"fmt" "fmt"
"time"
"os/exec" "os/exec"
"time"
) )
const ( const (

View File

@ -2,16 +2,16 @@ package desktop
import ( import (
"fmt" "fmt"
"time"
"sync" "sync"
"time"
"github.com/kataras/go-events" "github.com/kataras/go-events"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/config" "demodesk/neko/internal/config"
"demodesk/neko/internal/desktop/xorg"
"demodesk/neko/internal/desktop/xevent" "demodesk/neko/internal/desktop/xevent"
"demodesk/neko/internal/desktop/xorg"
) )
var mu = sync.Mutex{} var mu = sync.Mutex{}

View File

@ -8,9 +8,9 @@ package xevent
import "C" import "C"
import ( import (
"strings"
"time" "time"
"unsafe" "unsafe"
"strings"
"github.com/kataras/go-events" "github.com/kataras/go-events"
) )

View File

@ -2,11 +2,11 @@ package desktop
import ( import (
"image" "image"
"regexp"
"os/exec" "os/exec"
"regexp"
"demodesk/neko/internal/types"
"demodesk/neko/internal/desktop/xorg" "demodesk/neko/internal/desktop/xorg"
"demodesk/neko/internal/types"
) )
// TODO: Refactor. // TODO: Refactor.

View File

@ -11,8 +11,8 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/types"
"demodesk/neko/internal/config" "demodesk/neko/internal/config"
"demodesk/neko/internal/types"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
) )

View File

@ -2,9 +2,9 @@ package file
import ( import (
"encoding/json" "encoding/json"
"fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"fmt"
"sync" "sync"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"

View File

@ -1,11 +1,11 @@
package database package database
import ( import (
"demodesk/neko/internal/config"
"demodesk/neko/internal/session/database/dummy" "demodesk/neko/internal/session/database/dummy"
"demodesk/neko/internal/session/database/file" "demodesk/neko/internal/session/database/file"
"demodesk/neko/internal/session/database/object" "demodesk/neko/internal/session/database/object"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/config"
) )
func New(config *config.Session) types.MembersDatabase { func New(config *config.Session) types.MembersDatabase {

View File

@ -8,9 +8,9 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/config"
"demodesk/neko/internal/session/database" "demodesk/neko/internal/session/database"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/config"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"
) )

View File

@ -2,10 +2,10 @@ package utils
import ( import (
"bytes" "bytes"
"encoding/base64"
"image" "image"
"image/color" "image/color"
"image/png" "image/png"
"encoding/base64"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
) )

View File

@ -1,10 +1,10 @@
package utils package utils
import ( import (
"io"
"fmt"
"net/http"
"encoding/json" "encoding/json"
"fmt"
"io"
"net/http"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
) )

View File

@ -3,18 +3,18 @@ package webrtc
import ( import (
"fmt" "fmt"
"io" "io"
"strings"
"reflect" "reflect"
"strings"
"github.com/pion/webrtc/v3" "github.com/pion/webrtc/v3"
"github.com/pion/webrtc/v3/pkg/media" "github.com/pion/webrtc/v3/pkg/media"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/config"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/config"
) )
func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx { func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx {

View File

@ -1,9 +1,9 @@
package webrtc package webrtc
import ( import (
"fmt"
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/utils" "demodesk/neko/internal/utils"

View File

@ -39,7 +39,6 @@ func (ws *WebSocketManagerCtx) fileChooserDialogEvents() {
}, nil) }, nil)
}) })
// when new user joins, and someone holds dialog, he shouldd be notified about it. // when new user joins, and someone holds dialog, he shouldd be notified about it.
ws.sessions.OnConnected(func(session types.Session) { ws.sessions.OnConnected(func(session types.Session) {
if file_chooser_dialog_member == nil { if file_chooser_dialog_member == nil {

View File

@ -5,7 +5,6 @@ import (
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
) )
func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error { func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error {
if !session.IsHost() { if !session.IsHost() {
h.logger.Debug().Str("id", session.ID()).Msg("is not the host") h.logger.Debug().Str("id", session.ID()).Msg("is not the host")

View File

@ -2,8 +2,8 @@ package handler
import ( import (
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/message"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message"
) )
func (h *MessageHandlerCtx) sendUnicast(session types.Session, payload *message.SendUnicast) error { func (h *MessageHandlerCtx) sendUnicast(session types.Session, payload *message.SendUnicast) error {

View File

@ -23,7 +23,7 @@ func (h *MessageHandlerCtx) SessionDeleted(session types.Session) error {
message.MemberID{ message.MemberID{
Event: event.MEMBER_DELETED, Event: event.MEMBER_DELETED,
ID: session.ID(), ID: session.ID(),
}, nil); }, nil)
return nil return nil
} }

View File

@ -8,10 +8,10 @@ import (
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"demodesk/neko/internal/websocket/handler"
"demodesk/neko/internal/types" "demodesk/neko/internal/types"
"demodesk/neko/internal/types/event" "demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message" "demodesk/neko/internal/types/message"
"demodesk/neko/internal/websocket/handler"
) )
func New( func New(

10
neko.go
View File

@ -6,14 +6,14 @@ import (
"os/signal" "os/signal"
"runtime" "runtime"
"demodesk/neko/internal/api"
"demodesk/neko/internal/capture"
"demodesk/neko/internal/config" "demodesk/neko/internal/config"
"demodesk/neko/internal/desktop" "demodesk/neko/internal/desktop"
"demodesk/neko/internal/capture"
"demodesk/neko/internal/webrtc"
"demodesk/neko/internal/session"
"demodesk/neko/internal/websocket"
"demodesk/neko/internal/api"
"demodesk/neko/internal/http" "demodesk/neko/internal/http"
"demodesk/neko/internal/session"
"demodesk/neko/internal/webrtc"
"demodesk/neko/internal/websocket"
"demodesk/neko/modules" "demodesk/neko/modules"
"github.com/rs/zerolog" "github.com/rs/zerolog"