mirror of
https://github.com/cryptonote-social/csminer.git
synced 2024-09-11 05:35:23 +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,
|
rigid *C.char,
|
||||||
wallet *C.char,
|
wallet *C.char,
|
||||||
agent *C.char,
|
agent *C.char,
|
||||||
config *C.char) (
|
config *C.char,
|
||||||
|
bool dev) (
|
||||||
code int,
|
code int,
|
||||||
message *C.char) {
|
message *C.char) {
|
||||||
args := &minerlib.PoolLoginArgs{
|
args := &minerlib.PoolLoginArgs{
|
||||||
@ -23,6 +24,7 @@ func PoolLogin(
|
|||||||
Agent: C.GoString(agent),
|
Agent: C.GoString(agent),
|
||||||
Config: C.GoString(config),
|
Config: C.GoString(config),
|
||||||
UseTLS: true,
|
UseTLS: true,
|
||||||
|
Dev: dev,
|
||||||
}
|
}
|
||||||
resp := minerlib.PoolLogin(args)
|
resp := minerlib.PoolLogin(args)
|
||||||
return resp.Code, C.CString(resp.Message)
|
return resp.Code, C.CString(resp.Message)
|
||||||
|
@ -20,6 +20,8 @@ typedef struct pool_login_args {
|
|||||||
const char* agent;
|
const char* agent;
|
||||||
// config: advanced options config string, can be empty string
|
// config: advanced options config string, can be empty string
|
||||||
const char* config;
|
const char* config;
|
||||||
|
// dev: set to true to connect to develompent server instead of prod
|
||||||
|
bool dev;
|
||||||
} pool_login_args;
|
} pool_login_args;
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +46,8 @@ pool_login_response pool_login(const pool_login_args *args) {
|
|||||||
(char*)args->rigid,
|
(char*)args->rigid,
|
||||||
(char*)args->wallet,
|
(char*)args->wallet,
|
||||||
(char*)args->agent,
|
(char*)args->agent,
|
||||||
(char*)args->config);
|
(char*)args->config,
|
||||||
|
args->dev);
|
||||||
pool_login_response response;
|
pool_login_response response;
|
||||||
response.code = (int)r.r0;
|
response.code = (int)r.r0;
|
||||||
response.message = r.r1;
|
response.message = r.r1;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
csminer v0.2.0 (Linux/Gnome version)
|
csminer v0.3.0 (Linux/Gnome version)
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
|
|
||||||
@ -66,6 +66,9 @@ username and you can login with the username alone, e.g.:
|
|||||||
|
|
||||||
./csminer -user=your-chosen-username
|
./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
|
Implementation
|
||||||
|
|
||||||
csminer utilizes the RandomX implementation from https://github.com/tevador/RandomX and will
|
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
|
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
|
ExcludeHrStart, ExcludeHrEnd int
|
||||||
UseTLS bool
|
UseTLS bool
|
||||||
AdvancedConfig string
|
AdvancedConfig string
|
||||||
|
Dev bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func Mine(c *MinerConfig) error {
|
func Mine(c *MinerConfig) error {
|
||||||
@ -75,6 +76,7 @@ func Mine(c *MinerConfig) error {
|
|||||||
Agent: c.Agent,
|
Agent: c.Agent,
|
||||||
Config: c.AdvancedConfig,
|
Config: c.AdvancedConfig,
|
||||||
UseTLS: c.UseTLS,
|
UseTLS: c.UseTLS,
|
||||||
|
Dev: c.Dev,
|
||||||
})
|
})
|
||||||
if plResp.Code < 0 {
|
if plResp.Code < 0 {
|
||||||
crylog.Error("Pool server not responding:", plResp.Message)
|
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: Whether to use TLS when connecting to the pool
|
||||||
UseTLS bool
|
UseTLS bool
|
||||||
|
|
||||||
|
// Dev: Whether to connect to the dev server or prod
|
||||||
|
Dev bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type PoolLoginResponse struct {
|
type PoolLoginResponse struct {
|
||||||
@ -174,6 +177,20 @@ func getMiningActivityState() int {
|
|||||||
return MINING_ACTIVE
|
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
|
// Called by the user to log into the pool for the first time, or re-log into the pool with new
|
||||||
// credentials.
|
// credentials.
|
||||||
func PoolLogin(args *PoolLoginArgs) *PoolLoginResponse {
|
func PoolLogin(args *PoolLoginArgs) *PoolLoginResponse {
|
||||||
@ -207,10 +224,7 @@ func PoolLogin(args *PoolLoginArgs) *PoolLoginResponse {
|
|||||||
agent := args.Agent
|
agent := args.Agent
|
||||||
config := args.Config
|
config := args.Config
|
||||||
rigid := args.RigID
|
rigid := args.RigID
|
||||||
dest := "cryptonote.social:5555"
|
dest := getServerHostPort(args.UseTLS, args.Dev)
|
||||||
if args.UseTLS {
|
|
||||||
dest = "cryptonote.social:5556"
|
|
||||||
}
|
|
||||||
err, code, message, jc := cl.Connect(dest, args.UseTLS, agent, loginName, config, rigid)
|
err, code, message, jc := cl.Connect(dest, args.UseTLS, agent, loginName, config, rigid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if code != 0 {
|
if code != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user