mirror of
https://github.com/cryptonote-social/csminer.git
synced 2024-08-15 16:30:37 +03:00
added dev option to connect to dev server
This commit is contained in:
parent
e38fac56a6
commit
3e7e434f83
@ -13,7 +13,8 @@ func PoolLogin(
|
||||
rigid *C.char,
|
||||
wallet *C.char,
|
||||
agent *C.char,
|
||||
config *C.char) (
|
||||
config *C.char,
|
||||
bool dev) (
|
||||
code int,
|
||||
message *C.char) {
|
||||
args := &minerlib.PoolLoginArgs{
|
||||
@ -23,6 +24,7 @@ func PoolLogin(
|
||||
Agent: C.GoString(agent),
|
||||
Config: C.GoString(config),
|
||||
UseTLS: true,
|
||||
Dev: dev,
|
||||
}
|
||||
resp := minerlib.PoolLogin(args)
|
||||
return resp.Code, C.CString(resp.Message)
|
||||
|
@ -20,6 +20,8 @@ typedef struct pool_login_args {
|
||||
const char* agent;
|
||||
// config: advanced options config string, can be empty string
|
||||
const char* config;
|
||||
// dev: set to true to connect to develompent server instead of prod
|
||||
bool dev;
|
||||
} pool_login_args;
|
||||
|
||||
|
||||
@ -44,7 +46,8 @@ pool_login_response pool_login(const pool_login_args *args) {
|
||||
(char*)args->rigid,
|
||||
(char*)args->wallet,
|
||||
(char*)args->agent,
|
||||
(char*)args->config);
|
||||
(char*)args->config,
|
||||
args->dev);
|
||||
pool_login_response response;
|
||||
response.code = (int)r.r0;
|
||||
response.message = r.r1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
csminer v0.2.0 (Linux/Gnome version)
|
||||
csminer v0.3.0 (Linux/Gnome version)
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
@ -66,6 +66,9 @@ username and you can login with the username alone, e.g.:
|
||||
|
||||
./csminer -user=your-chosen-username
|
||||
|
||||
Wallet address must be specified however if you want to send authenticated chat messages or
|
||||
make config updates such as changing your notification e-mail address.
|
||||
|
||||
Implementation
|
||||
|
||||
csminer utilizes the RandomX implementation from https://github.com/tevador/RandomX and will
|
||||
@ -73,4 +76,5 @@ perform similarly to other mining software based on this library such as xmrig.
|
||||
|
||||
Feedback & Bug Reports
|
||||
|
||||
Send to: <cryptonote.social@gmail.com>
|
||||
Send to: <cryptonote.social@gmail.com>, or send a chat to the build-in chatroom using the "c <chat
|
||||
message>" key command.
|
||||
|
2
miner.go
2
miner.go
@ -46,6 +46,7 @@ type MinerConfig struct {
|
||||
ExcludeHrStart, ExcludeHrEnd int
|
||||
UseTLS bool
|
||||
AdvancedConfig string
|
||||
Dev bool
|
||||
}
|
||||
|
||||
func Mine(c *MinerConfig) error {
|
||||
@ -75,6 +76,7 @@ func Mine(c *MinerConfig) error {
|
||||
Agent: c.Agent,
|
||||
Config: c.AdvancedConfig,
|
||||
UseTLS: c.UseTLS,
|
||||
Dev: c.Dev,
|
||||
})
|
||||
if plResp.Code < 0 {
|
||||
crylog.Error("Pool server not responding:", plResp.Message)
|
||||
|
@ -116,6 +116,9 @@ type PoolLoginArgs struct {
|
||||
|
||||
// UseTLS: Whether to use TLS when connecting to the pool
|
||||
UseTLS bool
|
||||
|
||||
// Dev: Whether to connect to the dev server or prod
|
||||
Dev bool
|
||||
}
|
||||
|
||||
type PoolLoginResponse struct {
|
||||
@ -174,6 +177,20 @@ func getMiningActivityState() int {
|
||||
return MINING_ACTIVE
|
||||
}
|
||||
|
||||
func getServerHostPort(useTLS, dev bool) string {
|
||||
switch {
|
||||
case useTLS && !dev:
|
||||
return "cryptonote.social:5556"
|
||||
case !useTLS && !dev:
|
||||
return "cryptonote.social:5555"
|
||||
case useTLS && !dev:
|
||||
return "cryptonote.social:4445"
|
||||
// case !useTLS && dev:
|
||||
default:
|
||||
return "cryptonote.social:4444"
|
||||
}
|
||||
}
|
||||
|
||||
// Called by the user to log into the pool for the first time, or re-log into the pool with new
|
||||
// credentials.
|
||||
func PoolLogin(args *PoolLoginArgs) *PoolLoginResponse {
|
||||
@ -207,10 +224,7 @@ func PoolLogin(args *PoolLoginArgs) *PoolLoginResponse {
|
||||
agent := args.Agent
|
||||
config := args.Config
|
||||
rigid := args.RigID
|
||||
dest := "cryptonote.social:5555"
|
||||
if args.UseTLS {
|
||||
dest = "cryptonote.social:5556"
|
||||
}
|
||||
dest := getServerHostPort(args.UseTLS, args.Dev)
|
||||
err, code, message, jc := cl.Connect(dest, args.UseTLS, agent, loginName, config, rigid)
|
||||
if err != nil {
|
||||
if code != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user