mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Compare commits
3 commits
02a4728574
...
c250e8e3bb
Author | SHA1 | Date | |
---|---|---|---|
c250e8e3bb | |||
4c7d53547b | |||
be43734663 |
23 changed files with 105 additions and 49 deletions
19
.github/workflows/lint.yml
vendored
19
.github/workflows/lint.yml
vendored
|
@ -1,19 +0,0 @@
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
name: Test
|
|
||||||
jobs:
|
|
||||||
golangci:
|
|
||||||
name: lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: 1.22.x
|
|
||||||
- name: golangci-lint
|
|
||||||
uses: golangci/golangci-lint-action@v4
|
|
||||||
with:
|
|
||||||
version: latest
|
|
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -39,7 +39,7 @@ jobs:
|
||||||
goarch: ${{ matrix.goarch }}
|
goarch: ${{ matrix.goarch }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
pre_command: export CGO_ENABLED=0
|
pre_command: export CGO_ENABLED=0
|
||||||
ldflags: -s -w -X xmr-remote-nodes/internal/config.Version=${{github.ref_name}}
|
ldflags: -s -w -X github.com/ditatompel/xmr-remote-nodes/internal/config.Version=${{github.ref_name}}
|
||||||
build_flags: -tags server
|
build_flags: -tags server
|
||||||
project_path: .
|
project_path: .
|
||||||
binary_name: server
|
binary_name: server
|
||||||
|
@ -53,7 +53,7 @@ jobs:
|
||||||
goarch: ${{ matrix.goarch }}
|
goarch: ${{ matrix.goarch }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
pre_command: export CGO_ENABLED=0
|
pre_command: export CGO_ENABLED=0
|
||||||
ldflags: -s -w -X xmr-remote-nodes/internal/config.Version=${{github.ref_name}}
|
ldflags: -s -w -X github.com/ditatompel/xmr-remote-nodes/internal/config.Version=${{github.ref_name}}
|
||||||
binary_name: client
|
binary_name: client
|
||||||
project_path: .
|
project_path: .
|
||||||
extra_files: LICENSE README.md
|
extra_files: LICENSE README.md
|
||||||
|
|
51
.github/workflows/test.yml
vendored
Normal file
51
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
name: Test
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.22.x
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
|
- name: Run lint
|
||||||
|
uses: golangci/golangci-lint-action@v4
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
- name: setup NodeJS
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: Cache node modules
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Build UI
|
||||||
|
run: make ui
|
||||||
|
|
||||||
|
- name: Run test
|
||||||
|
run: make test
|
14
Makefile
14
Makefile
|
@ -27,7 +27,7 @@ ifdef RELEASE_TAG
|
||||||
endif
|
endif
|
||||||
# end modified rclone's Makefile
|
# end modified rclone's Makefile
|
||||||
|
|
||||||
BUILD_LDFLAGS := -s -w -X xmr-remote-nodes/internal/config.Version=$(TAG)
|
BUILD_LDFLAGS := -s -w -X github.com/ditatompel/xmr-remote-nodes/internal/config.Version=$(TAG)
|
||||||
|
|
||||||
# This called from air cmd (see .air.toml)
|
# This called from air cmd (see .air.toml)
|
||||||
.PHONY: dev
|
.PHONY: dev
|
||||||
|
@ -65,6 +65,18 @@ clean:
|
||||||
rm -rfv ./bin
|
rm -rfv ./bin
|
||||||
rm -rf ./frontend/build
|
rm -rf ./frontend/build
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
golangci-lint run ./...
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
go test -race -cover ./...
|
||||||
|
|
||||||
|
.PHONY: bench
|
||||||
|
bench:
|
||||||
|
go test ./... -bench=. -benchmem -run=^#
|
||||||
|
|
||||||
# Deploying new binary file to server and probers host
|
# Deploying new binary file to server and probers host
|
||||||
# The deploy-* command doesn't build the binary file, so you need to run `make build` first.
|
# The deploy-* command doesn't build the binary file, so you need to run `make build` first.
|
||||||
# And make sure the inventory and deploy-*.yml file is properly configured.
|
# And make sure the inventory and deploy-*.yml file is properly configured.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# XMR Remote Nodes
|
# XMR Remote Nodes
|
||||||
|
|
||||||
[![Lint](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/lint.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/lint.yml)
|
[![Test](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/test.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/test.yml)
|
||||||
[![BUild](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/build.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/build.yml)
|
[![BUild](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/build.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/build.yml)
|
||||||
[![Release Binaries](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/release.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/release.yml)
|
[![Release Binaries](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/release.yml/badge.svg)](https://github.com/ditatompel/xmr-remote-nodes/actions/workflows/release.yml)
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/config"
|
|
||||||
"xmr-remote-nodes/internal/monero"
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/net/proxy"
|
"golang.org/x/net/proxy"
|
||||||
|
|
|
@ -2,8 +2,9 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"xmr-remote-nodes/cmd/client"
|
|
||||||
"xmr-remote-nodes/internal/config"
|
"github.com/ditatompel/xmr-remote-nodes/cmd/client"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,8 +5,9 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/cron"
|
|
||||||
"xmr-remote-nodes/internal/database"
|
"github.com/ditatompel/xmr-remote-nodes/internal/cron"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import "xmr-remote-nodes/cmd"
|
import "github.com/ditatompel/xmr-remote-nodes/cmd"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cmd.Root.AddCommand(serveCmd)
|
cmd.Root.AddCommand(serveCmd)
|
||||||
|
|
|
@ -9,8 +9,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/database"
|
|
||||||
"xmr-remote-nodes/internal/monero"
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,11 +7,12 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/frontend"
|
|
||||||
"xmr-remote-nodes/handler"
|
"github.com/ditatompel/xmr-remote-nodes/frontend"
|
||||||
"xmr-remote-nodes/internal/config"
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
||||||
"xmr-remote-nodes/internal/cron"
|
"github.com/ditatompel/xmr-remote-nodes/internal/cron"
|
||||||
"xmr-remote-nodes/internal/database"
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/handler"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module xmr-remote-nodes
|
module github.com/ditatompel/xmr-remote-nodes
|
||||||
|
|
||||||
go 1.22.2
|
go 1.22.2
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ import (
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/database"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CronRepository interface {
|
type CronRepository interface {
|
||||||
|
|
|
@ -2,7 +2,8 @@ package database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"xmr-remote-nodes/internal/config"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"xmr-remote-nodes/internal/monero"
|
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
|
@ -2,7 +2,8 @@ package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"xmr-remote-nodes/internal/monero"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
|
||||||
|
|
||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
|
@ -10,7 +10,8 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/database"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx/types"
|
"github.com/jmoiron/sqlx/types"
|
||||||
)
|
)
|
||||||
|
|
|
@ -5,8 +5,9 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"xmr-remote-nodes/internal/config"
|
|
||||||
"xmr-remote-nodes/internal/database"
|
"github.com/ditatompel/xmr-remote-nodes/internal/config"
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testMySQL = true
|
var testMySQL = true
|
||||||
|
|
|
@ -4,7 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"xmr-remote-nodes/internal/database"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,8 @@ import (
|
||||||
"slices"
|
"slices"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"xmr-remote-nodes/internal/geo"
|
|
||||||
|
"github.com/ditatompel/xmr-remote-nodes/internal/geo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type QueryLogs struct {
|
type QueryLogs struct {
|
||||||
|
|
2
main.go
2
main.go
|
@ -1,7 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"xmr-remote-nodes/cmd"
|
"github.com/ditatompel/xmr-remote-nodes/cmd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import _ "xmr-remote-nodes/cmd/server"
|
import _ "github.com/ditatompel/xmr-remote-nodes/cmd/server"
|
||||||
|
|
Loading…
Reference in a new issue