Coder Social home page Coder Social logo

moguli / stratum-proxy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stratehm/stratum-proxy

0.0 2.0 0.0 3.68 MB

Java implementation of a stratum->stratum/HTTPGetwork proxy with a Web GUI and some pool switching strategies (PriorityFailover, WeightedRoundRobin). Simple to install and configure.

License: GNU General Public License v3.0

stratum-proxy's Introduction

#Packaging (Not mandatory)

You can directly use a release (https://github.com/Stratehm/stratum-proxy/releases) and go to the Installation and Usage section.

The packaging of the application is done through Maven and will generate a ZIP which contains the program and all its dependencies.

The proxy is is generated as a JAR file called stratum-proxy.jar (contained in the ZIP file) which can be launched on any platform with a JVM installed with version >= 7 (Java Virtual Machine)

To build the package, you must have a JDK installed in version >= 7 and maven 3

##Packaging

cd /directory/which/contain/pom.xmlFileOfTheProject

mvn clean package

The package is then present in the "target" directory.

#Installation and Usage

##Installation

The latest JVM (Java Virtual Machine) can be downloaded here: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html Install the JVM for your operating system (if not already done)

Then unzip the zip file in a directory and launch the proxy through the following command line:

java -jar stratum-proxy.jar proxyOptions

##Usage

java -jar stratum-proxy.jar --help

##Configuration File

In order to use a configuration file instead of the command line parameters, use the following command line options:

java -jar stratum-proxy.jar -f /path/to/the/configuration/file

When -f option is used, all other command line options are discarded and only the configuration file is used.

The files stratum-proxy-minimal-sample.conf and stratum-proxy-full-sample.conf in the package can be used to build your own configuration file.

##WebClient

A WebClient is available at the address: http://127.0.0.1:8888 (The port can be changed with --rest-listen-port or apiListenAddress of configuration file).

GUI example

##API Details

A REST API is available. Methods parameters or result are in JSON. By default, the methods can be accessed at the URL http://hostIp:8888/proxy/.

The Content-Type of HTTP requests has to be application/json, else a 415 Unsupported Media Type error may be returned.

Here after is the API methods description:

  • pool/list: (GET) List all the pools.
Parameters: None
Return: [ { "name": string, "host": string, "username": string, "password": string, "isActive": boolean, "isEnabled": boolean, "isStable": boolean, "isActiveSince": Date(dd-MM-yy HH:mm:ss Z), "difficulty": string, "extranonce1": string, "extranonce2Size": integer, "workerExtranonce2Size": integer, "numberOfWorkerConnections": integer, "priority": integer, "acceptedDifficulty": double, "rejectedDifficulty": double, "isExtranonceSubscribeEnabled": boolean, "acceptedHashesPerSeconds": long, "rejectedHashesPerSeconds": long }, ... ]
  • user/list: (GET) List all the seen users.
Parameters: None
Return: [ { "name": string, "firstConnectionDate": Date(dd-MM-yy HH:mm:ss Z), "lastShareSubmitted": Date(dd-MM-yy HH:mm:ss Z), "acceptedHashesPerSeconds": long, "rejectedHashesPerSeconds": long, "connections": [ { "remoteHost": string, "authorizedUsers": [ string, ... ], "acceptedHashesPerSeconds": long, "rejectedHashesPerSeconds": long, "isActiveSince": Date(dd-MM-yy HH:mm:ss Z), "poolName": string }, ... ] } ]
  • connection/list: (GET) List all the active workers connection
Parameters: None
Return: [ { "remoteHost": string, "authorizedUsers": [ string, ... ], "acceptedHashesPerSeconds": long, "rejectedHashesPerSeconds": long, "isActiveSince": Date(dd-MM-yy HH:mm:ss Z), "poolName": string }, ... ]
  • pool/add: (POST) Add a new pool
Parameters: { "poolName": string (optional=poolHost), "poolHost": string, "username": string, "password": string, "priority": integer (optional=lowestOne), "enableExtranonceSubscribe": boolean (optional=false),  "isEnabled": boolean (optional=true), "appendWorkerNames": boolean (optional=false), "workerNameSeparator": string (optional=.), "useWorkerPassword": boolean (optional=false)}
Return: {"status": string, "message": string}. Returned statuses are DONE, DONE_PARTIALLY (if added but not started) or FAILED.
  • pool/remove: (POST) Remove a pool
Parameters: { "poolName": string}
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • pool/priority: (POST) Change the priority of a pool
Parameters: {"poolName": string, "priority": integer}
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • pool/disable: (POST) Disable the pool with the given name
Parameters: {"poolName": string}
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • pool/enable: (POST) Disable the pool with the given name
Parameters: {"poolName": string}
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • log/level: (POST) Change the log level.
Parameters: {"logLevel": string}. Valid Levels are FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF.
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • user/kick: (POST) Kick all connections of the user
Parameters: {"username": string}.
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • user/ban: (POST) Kick all connections of the user then ban the user until the next proxy restart.
Parameters: {"username": string}.
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • user/unban: (POST) Unban the user
Parameters: {"username": string}.
Return: {"status": string, "message": string}. Returned statuses are DONE or FAILED.
  • user/ban/list: (GET) List all banned users
Parameters: none
Return: [ string, ... ]. Returned statuses are DONE or FAILED.

#License

GPLv3

Of course, if you want make a little donation, you are welcome :)

BTC: 19wv8FQKv3NkwTdzBCQn1AGsb9ghqBPWXi

stratum-proxy's People

Contributors

stratehm avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.