This commit introduces the initial implementation of the xmrig-proxy functionality. It includes: - A new `proxy` command to the CLI to start the proxy. - A new `pkg/proxy` package to encapsulate the core proxy logic. - A mock proxy service that simulates workers connecting. - The initial implementation of the XMRig Proxy API, with the `/` and `/workers.json` endpoints.
22 lines
345 B
Go
22 lines
345 B
Go
package proxy
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestProxy(t *testing.T) {
|
|
proxy := New()
|
|
proxy.Start()
|
|
time.Sleep(6 * time.Second)
|
|
proxy.Stop()
|
|
|
|
summary := proxy.Summary()
|
|
assert.NotNil(t, summary)
|
|
|
|
workers := proxy.WorkersSummary()
|
|
assert.NotNil(t, workers)
|
|
assert.True(t, len(workers) > 0)
|
|
}
|