cjdns admin
1.0.0
用於透過 UDP 處理 CJDNS 管理介面的 Nodejs 模組。它具有一致、穩健且易於使用的特性。
跳:
它可以透過 npm 獲得
npm install cjdns-admin
createAdmin
函數傳回一個 EventEmitter4,其中包含每個管理函數及其備用函數的成員。它還包含處理分頁功能的自動分頁的成員。
選項:
用法:
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 ) ;
原來的 | 備用 |
---|---|
Admin_asyncEnabled | admin.asyncEnabled |
Admin_availableFunctions | admin.availableFunctions |
admin.availableFunctionsPaged | |
AdminLog_logMany | log.logMany |
管理日誌_訂閱 | 日誌訂閱 |
管理日誌_訂閱 | 日誌訂閱 |
AdminLog_取消訂閱 | 取消訂閱日誌 |
Allocator_bytes已指派 | 分配器.bytes已分配 |
分配器快照 | 分配器.快照 |
授權密碼_add | 授權密碼.add |
授權密碼列表 | 授權密碼列表 |
授權密碼_刪除 | 授權密碼.remove |
核心退出 | 核心退出 |
Core_initTunnel | core.initTunnel |
核心進程號 | 核心.pid |
InterfaceController_disconnectPeer | 介面Controller.disconnectPeer |
InterfaceController_peerStats | 介面控制器.peerStats |
介面控制器.peerStatsPaged | |
IpTunnel_allowConnection | ipTunnel.allowConnection |
IpTunnel_connectTo | ipTunnel.connectTo |
IpTunnel_listConnections | ipTunnel.listConnections |
IpTunnel_removeConnection | ipTunnel.removeConnection |
IpTunnel_showConnection | ipTunnel.showConnection |
Janitor_dumpRumorMill | janitor.dumpRumorMill |
記憶 | 管理記憶體 |
nodeStore.dumpTablePaged | |
NodeStore_getLink | 節點儲存.getLink |
NodeStore_getRouteLabel | nodeStore.getRouteLabel |
NodeStore_nodeForAddr | 節點儲存.nodeForAddr |
平 | 管理.ping |
RouterModule_findNode | routerModule.findNode |
RouterModule_getPeers | routerModule.getPeers |
RouterModule_lookup | routerModule.lookup |
RouterModule_nextHop | routerModule.nextHop |
RouterModule_pingNode | routerModule.pingNode |
SearchRunner_showActiveSearch | searchRunner.showActiveSearch |
SearchRunner_search | searchRunner.search |
Security_checkPermissions | security.checkPermissions |
安全_chroot | 安全.chroot |
安全取得用戶 | 安全性.getUser |
安全_nofiles | 安全.nofiles |
安全_noforks | 安全.noforks |
安全_seccomp | 安全.seccomp |
安全設定完成 | 安全.setupComplete |
安全設定用戶 | 安全性.setUser |
SessionManager_getHandles | sessionManager.getHandles |
sessionManager.getHandlesPaged | |
SessionManager_sessionStats | sessionManager.sessionStats |
SwitchPinger_ping | switchPinger.ping |
UDPInterface_beginConnection | udpInterface.beginConnection |
UDP介面_new | udp介面.new |
用法:
channel = admin . asyncEnabled ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . availableFunctions ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
count : 0
} ;
channel = admin . log . logMany ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
file : '' ,
level : '' ,
line : 0
} ;
channel = admin . log . subscribe ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . log . subscriptions ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
streamId : ''
} ;
channel = admin . log . unsubscribe ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . allocator . bytesAllocated ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
includeAllocations : 0
} ;
channel = admin . allocator . snapshot ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
authType : 0 ,
ipv6 : '' ,
password : '' ,
user : ''
} ;
channel = admin . authorizedPasswords . add ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . authorizedPasswords . list ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
user : ''
} ;
channel = admin . authorizedPasswords . remove ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . core . exit ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
desiredTunName : ''
} ;
channel = admin . core . initTunnel ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . core . pid ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
pubkey : ''
} ;
channel = admin . interfaceController . disconnectPeer ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . interfaceController . peerStats ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
ip4Address : '' ,
ip4Prefix : 0 ,
ip6Address : '' ,
ip6Prefix : 0 ,
publicKeyOfAuthorizedNode : ''
} ;
channel = admin . ipTunnel . allowConnection ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
publicKeyOfNodeToConnectTo : ''
} ;
channel = admin . ipTunnel . connectTo ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . ipTunnel . listConnections ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
connection : 0
} ;
channel = admin . ipTunnel . removeConnection ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
connection : 0
} ;
channel = admin . ipTunnel . showConnection ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
mill : '' ,
page : 0
} ;
channel = admin . janitor . dumpRumorMill ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . memory ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . nodeStore . dumpTable ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
linkNum : 0 ,
parent : ''
} ;
channel = admin . nodeStore . getLink ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
pathParentToChild : '' ,
pathToParent : ''
} ;
channel = admin . nodeStore . getRouteLabel ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
ip : ''
} ;
channel = admin . nodeStore . nodeForAddr ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . ping ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
nodeToQuery : '' ,
target : '' ,
timeout : 0
} ;
channel = admin . routerModule . findNode ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
nearbyPath : '' ,
path : '' ,
timeout : 0
} ;
channel = admin . routerModule . getPeers ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
address : ''
} ;
channel = admin . routerModule . lookup ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
nodeToQuery : '' ,
target : '' ,
timeout : 0
} ;
channel = admin . routerModule . nextHop ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
path : '' ,
timeout : 0
} ;
channel = admin . routerModule . pingNode ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
ipv6 : '' ,
maxRequests : 0
} ;
channel = admin . searchRunner . search ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
number : 0
} ;
channel = admin . searchRunner . showActiveSearch ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . security . checkPermissions ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
root : ''
} ;
channel = admin . security . chroot ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
user : ''
} ;
channel = admin . security . getUser ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . security . nofiles ( ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . security . noforks ( ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . security . seccomp ( ) ;
admin . once ( channel , processResponse ) ;
用法:
channel = admin . security . setupComplete ( ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
keepNetAdmin : 0 ,
uid : 0
} ;
channel = admin . security . setUser ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
page : 0
} ;
channel = admin . sessionManager . getHandles ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
handle : 0
} ;
channel = admin . sessionManager . sessionStats ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
data : '' ,
keyPing : 0 ,
path : '' ,
timeout : 0
} ;
channel = admin . switchPinger . ping ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
address : '' ,
interfaceNumber : 0 ,
password : '' ,
publicKey : ''
} ;
channel = admin . udpInterface . beginConnection ( options ) ;
admin . once ( channel , processResponse ) ;
用法:
var channel ,
options ;
options = {
bindAddress : ''
} ;
channel = admin . udpInterface . new ( options ) ;
admin . once ( channel , processResponse ) ;
分頁函數將取得所有頁面並傳回結果。傳遞選項是可選的。回呼接收err
和results
作為參數,兩者都是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 ) ;
建立測試將尋找的環境變數:
# cjdns development environment
export CJDNS_ADMIN_PORT=11234
export CJDNS_ADMIN_IP=127.0.0.1
export CJDNS_ADMIN_PASSWORD=from your cjdroute config
工具可透過 npm 腳本取得。請參閱scripts
部分中的package.json
。
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