Un módulo de nodejs para trabajar con la interfaz de administración CJDNS a través de UDP. Está diseñado para ser consistente, robusto y fácil de usar.
Saltar:
Está disponible a través de npm
npm install cjdns-admin
La función createAdmin
devuelve un EventEmitter4 con miembros para cada función de administración y su alternativa. También contiene miembros que manejan la paginación automática para funciones paginadas.
Opciones:
Uso:
var cjdnsAdmin = require ( 'cjdns-admin' ) ,
admin ,
channel ;
// create a new Admin
admin = cjdnsAdmin . createAdmin ( {
ip : '127.0.0.1' ,
port : 11234 ,
password : 'my cjdns password'
} ) ;
// ping the admin
channel = admin . ping ( ) ;
// create a response handler
function pingResponse ( res ) {
// process ping response
console . dir ( res ) ;
}
// handle the response
admin . on ( channel , pingResponse ) ;
Original | Alternar |
---|---|
Admin_asyncEnabled | admin.asyncEnabled |
Funciones admin_disponibles | admin.disponibleFunciones |
admin.disponibleFuncionesPáginas | |
AdminLog_logMuchos | log.logMuchos |
AdminLog_subscribe | iniciar sesión.suscribirse |
AdminLog_subscripciones | registro.suscripciones |
AdminLog_unsubscribe | registro.cancelar suscripción |
Allocator_bytesAsignado | allocator.bytesAsignado |
Instantánea_del_asignador | asignador.instantánea |
Contraseñas autorizadas_add | contraseñasautorizadas.add |
Lista de contraseñas autorizadas | lista de contraseñas autorizadas |
Contraseñas autorizadas_eliminar | contraseñasautorizadas.eliminar |
salida_core | núcleo.salir |
Core_initTunnel | core.initTúnel |
núcleo_pid | núcleo.pid |
InterfaceController_disconnectPeer | interfazController.disconnectPeer |
InterfazController_peerStats | interfazController.peerStats |
interfazController.peerStatsPagged | |
IpTunnel_allowConnection | ipTunnel.allowConnection |
IpTunnel_connectTo | ipTunnel.connectTo |
IpTunnel_listConexiones | ipTunnel.listConexiones |
IpTunnel_removeConnection | ipTunnel.removeConnection |
IpTunnel_showConexión | ipTunnel.showConnection |
Janitor_dumpRumorMill | janitor.dumpRumorMill |
memoria | admin.memoria |
nodeStore.dumpTablePaged | |
NodeStore_getLink | nodeStore.getLink |
NodeStore_getRouteLabel | nodeStore.getRouteLabel |
NodeStore_nodeForAddr | nodeStore.nodeForAddr |
silbido | administrador.ping |
RouterModule_findNode | routerModule.findNode |
RouterModule_getPeers | routerModule.getPeers |
enrutadorModule_lookup | routerModule.búsqueda |
RouterModule_nextHop | enrutadorModule.nextHop |
RouterModule_pingNode | routerModule.pingNodo |
SearchRunner_showActiveSearch | searchRunner.showActiveSearch |
BuscarRunner_search | searchRunner.búsqueda |
Security_checkPermisos | seguridad.checkPermisos |
seguridad_chroot | seguridad.chroot |
Seguridad_getUser | seguridad.getUser |
seguridad_nofiles | seguridad.nofiles |
seguridad_noforks | seguridad.noforks |
seguridad_seccomp | seguridad.seccomp |
Configuración_seguridad completa | seguridad.setupComplete |
Usuario_set_seguridad | seguridad.setUsuario |
SessionManager_getHandles | sessionManager.getHandles |
sessionManager.getHandlesPagged | |
SessionManager_sessionStats | sessionManager.sessionStats |
CambiarPinger_ping | cambiarPinger.ping |
UDPInterface_beginConexión | udpInterface.beginConexión |
UDPInterface_new | udpInterface.nuevo |
Uso:
channel = admin . asyncEnabled ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . availableFunctions ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
count : 0
} ;
channel = admin . log . logMany ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
file : '' ,
level : '' ,
line : 0
} ;
channel = admin . log . subscribe ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . log . subscriptions ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
streamId : ''
} ;
channel = admin . log . unsubscribe ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . allocator . bytesAllocated ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
includeAllocations : 0
} ;
channel = admin . allocator . snapshot ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
authType : 0 ,
ipv6 : '' ,
password : '' ,
user : ''
} ;
channel = admin . authorizedPasswords . add ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . authorizedPasswords . list ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
user : ''
} ;
channel = admin . authorizedPasswords . remove ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . core . exit ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
desiredTunName : ''
} ;
channel = admin . core . initTunnel ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . core . pid ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
pubkey : ''
} ;
channel = admin . interfaceController . disconnectPeer ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . interfaceController . peerStats ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
ip4Address : '' ,
ip4Prefix : 0 ,
ip6Address : '' ,
ip6Prefix : 0 ,
publicKeyOfAuthorizedNode : ''
} ;
channel = admin . ipTunnel . allowConnection ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
publicKeyOfNodeToConnectTo : ''
} ;
channel = admin . ipTunnel . connectTo ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . ipTunnel . listConnections ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
connection : 0
} ;
channel = admin . ipTunnel . removeConnection ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
connection : 0
} ;
channel = admin . ipTunnel . showConnection ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
mill : '' ,
page : 0
} ;
channel = admin . janitor . dumpRumorMill ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . memory ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . nodeStore . dumpTable ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
linkNum : 0 ,
parent : ''
} ;
channel = admin . nodeStore . getLink ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
pathParentToChild : '' ,
pathToParent : ''
} ;
channel = admin . nodeStore . getRouteLabel ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
ip : ''
} ;
channel = admin . nodeStore . nodeForAddr ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . ping ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
nodeToQuery : '' ,
target : '' ,
timeout : 0
} ;
channel = admin . routerModule . findNode ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
nearbyPath : '' ,
path : '' ,
timeout : 0
} ;
channel = admin . routerModule . getPeers ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
address : ''
} ;
channel = admin . routerModule . lookup ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
nodeToQuery : '' ,
target : '' ,
timeout : 0
} ;
channel = admin . routerModule . nextHop ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
path : '' ,
timeout : 0
} ;
channel = admin . routerModule . pingNode ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
ipv6 : '' ,
maxRequests : 0
} ;
channel = admin . searchRunner . search ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
number : 0
} ;
channel = admin . searchRunner . showActiveSearch ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . security . checkPermissions ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
root : ''
} ;
channel = admin . security . chroot ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
user : ''
} ;
channel = admin . security . getUser ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . security . nofiles ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . security . noforks ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . security . seccomp ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
channel = admin . security . setupComplete ( ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
keepNetAdmin : 0 ,
uid : 0
} ;
channel = admin . security . setUser ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . sessionManager . getHandles ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
handle : 0
} ;
channel = admin . sessionManager . sessionStats ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
data : '' ,
keyPing : 0 ,
path : '' ,
timeout : 0
} ;
channel = admin . switchPinger . ping ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
address : '' ,
interfaceNumber : 0 ,
password : '' ,
publicKey : ''
} ;
channel = admin . udpInterface . beginConnection ( options ) ;
admin . once ( channel , processResponse ) ;
Uso:
var channel ,
options ;
options = {
bindAddress : ''
} ;
channel = admin . udpInterface . new ( options ) ;
admin . once ( channel , processResponse ) ;
Las funciones paginadas buscarán todas las páginas y devolverán el resultado. Pasar opciones es opcional. La devolución de llamada recibe err
y results
como argumentos y ambos son tipos Array
.
function pagedCallback ( err , results ) {
if ( err ) {
return console . log ( 'paged callback error' , err ) ;
}
console . log ( 'paged function results array' , ) ;
}
admin . availableFunctionsPaged ( pagedCallback ) ;
admin . interfaceController . peerStatsPaged ( pagedCallback ) ;
admin . nodeStore . dumpTablePaged ( pagedCallback ) ;
admin . sessionManager . getHandlesPaged ( pagedCallback ) ;
// mill property is optional
admin . janitor . dumpRumorMillPaged ( { mill : '' } , pagedCallback ) ;
Cree variables de entorno que buscarán las pruebas:
# cjdns development environment
export CJDNS_ADMIN_PORT=11234
export CJDNS_ADMIN_IP=127.0.0.1
export CJDNS_ADMIN_PASSWORD=from your cjdroute config
Las herramientas están disponibles a través de scripts npm. Consulte package.json
en la sección scripts
.
npm run lint
# test offline functionality
npm test
npm test -- --watch
# test online, UDP, and potentially dangerous functions
# on an actual node
npm run test-live
npm run test-live -- --watch
# render docs to html for testing
npm run doc-gen
npm run doc-watch