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"
"demodesk/neko"
"demodesk/neko/modules"
"demodesk/neko/internal/config"
"demodesk/neko/modules"
)
func init() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,8 +2,8 @@ package handler
import (
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/message"
"demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message"
)
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{
Event: event.MEMBER_DELETED,
ID: session.ID(),
}, nil);
}, nil)
return nil
}

View File

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

10
neko.go
View File

@ -6,14 +6,14 @@ import (
"os/signal"
"runtime"
"demodesk/neko/internal/api"
"demodesk/neko/internal/capture"
"demodesk/neko/internal/config"
"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/session"
"demodesk/neko/internal/webrtc"
"demodesk/neko/internal/websocket"
"demodesk/neko/modules"
"github.com/rs/zerolog"