mirror of https://github.com/jetkvm/kvm.git
Fix more linter issues.
Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
parent
75296b4b7e
commit
97ce785056
|
@ -3,9 +3,10 @@ package kvm
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"kvm/internal/usbgadget"
|
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/jetkvm/kvm/internal/usbgadget"
|
||||||
)
|
)
|
||||||
|
|
||||||
type WakeOnLanDevice struct {
|
type WakeOnLanDevice struct {
|
||||||
|
|
|
@ -6,10 +6,6 @@ import (
|
||||||
|
|
||||||
var lastUserInput = time.Now()
|
var lastUserInput = time.Now()
|
||||||
|
|
||||||
func resetUserInputTime() {
|
|
||||||
lastUserInput = time.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
var jigglerEnabled = false
|
var jigglerEnabled = false
|
||||||
|
|
||||||
func rpcSetJigglerState(enabled bool) {
|
func rpcSetJigglerState(enabled bool) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"kvm/internal/usbgadget"
|
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -15,6 +14,8 @@ import (
|
||||||
|
|
||||||
"github.com/pion/webrtc/v4"
|
"github.com/pion/webrtc/v4"
|
||||||
"go.bug.st/serial"
|
"go.bug.st/serial"
|
||||||
|
|
||||||
|
"github.com/jetkvm/kvm/internal/usbgadget"
|
||||||
)
|
)
|
||||||
|
|
||||||
type JSONRPCRequest struct {
|
type JSONRPCRequest struct {
|
||||||
|
|
1
log.go
1
log.go
|
@ -5,5 +5,4 @@ import "github.com/pion/logging"
|
||||||
// we use logging framework from pion
|
// we use logging framework from pion
|
||||||
// ref: https://github.com/pion/webrtc/wiki/Debugging-WebRTC
|
// ref: https://github.com/pion/webrtc/wiki/Debugging-WebRTC
|
||||||
var logger = logging.NewDefaultLoggerFactory().NewLogger("jetkvm")
|
var logger = logging.NewDefaultLoggerFactory().NewLogger("jetkvm")
|
||||||
var usbLogger = logging.NewDefaultLoggerFactory().NewLogger("usb")
|
|
||||||
var cloudLogger = logging.NewDefaultLoggerFactory().NewLogger("cloud")
|
var cloudLogger = logging.NewDefaultLoggerFactory().NewLogger("cloud")
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"kvm/resource"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
|
6
usb.go
6
usb.go
|
@ -1,7 +1,7 @@
|
||||||
package kvm
|
package kvm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"kvm/internal/usbgadget"
|
"github.com/jetkvm/kvm/internal/usbgadget"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,10 +37,6 @@ func rpcWheelReport(wheelY int8) error {
|
||||||
return gadget.AbsMouseWheelReport(wheelY)
|
return gadget.AbsMouseWheelReport(wheelY)
|
||||||
}
|
}
|
||||||
|
|
||||||
func rpcRelMouseReport(mx, my int8, buttons uint8) error {
|
|
||||||
return gadget.RelMouseReport(mx, my, buttons)
|
|
||||||
}
|
|
||||||
|
|
||||||
var usbState = "unknown"
|
var usbState = "unknown"
|
||||||
|
|
||||||
func rpcGetUSBState() (state string) {
|
func rpcGetUSBState() (state string) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"kvm/resource"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -16,14 +15,12 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"github.com/psanford/httpreadat"
|
"github.com/psanford/httpreadat"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/pion/webrtc/v4"
|
"github.com/pion/webrtc/v4"
|
||||||
)
|
|
||||||
|
|
||||||
const massStorageName = "mass_storage.usb0"
|
"github.com/jetkvm/kvm/resource"
|
||||||
|
)
|
||||||
|
|
||||||
func writeFile(path string, data string) error {
|
func writeFile(path string, data string) error {
|
||||||
return os.WriteFile(path, []byte(data), 0644)
|
return os.WriteFile(path, []byte(data), 0644)
|
||||||
|
@ -65,11 +62,11 @@ func onDiskMessage(msg webrtc.DataChannelMessage) {
|
||||||
func mountImage(imagePath string) error {
|
func mountImage(imagePath string) error {
|
||||||
err := setMassStorageImage("")
|
err := setMassStorageImage("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Remove Mass Storage Image Error", err)
|
return fmt.Errorf("Remove Mass Storage Image Error: %w", err)
|
||||||
}
|
}
|
||||||
err = setMassStorageImage(imagePath)
|
err = setMassStorageImage(imagePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Set Mass Storage Image Error", err)
|
return fmt.Errorf("Set Mass Storage Image Error: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue