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.availableFunctionsPages | |
AdminLog_logMany | ログ.logMany |
AdminLog_subscribe | ログ.サブスクライブ |
AdminLog_subscriptions | ログ.サブスクリプション |
AdminLog_購読解除 | ログ.購読解除 |
Allocator_bytesAllocated | allocator.bytesAllocated |
アロケータ_スナップショット | アロケータ.スナップショット |
AuthorizedPasswords_add | 認可されたパスワード.追加 |
認可されたパスワードのリスト | 許可されたパスワード.リスト |
AuthorizedPasswords_remove | 認可されたパスワード.削除 |
コア出口 | コア.終了 |
Core_initTunnel | core.initTunnel |
コアピッド | コア.pid |
InterfaceController_disconnectPeer | InterfaceController.disconnectPeer |
InterfaceController_peerStats | InterfaceController.peerStats |
InterfaceController.peerStatsPages | |
IpTunnel_allowConnection | ipTunnel.allowConnection |
IpTunnel_connectTo | ipTunnel.connectTo |
IpTunnel_listConnections | ipTunnel.listConnections |
IpTunnel_removeConnection | ipTunnel.removeConnection |
IpTunnel_showConnection | ipTunnel.showConnection |
Janitor_dumpRumorMill | 管理人.dumpRumorMill |
メモリ | 管理者メモリ |
nodeStore.dumpTablePages | |
ノードストア_getLink | ノードストア.getLink |
NodeStore_getRouteLabel | ノードストア.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 | 検索ランナー.検索 |
Security_check権限 | security.checkPermissions |
Security_chroot | security.chroot |
Security_getUser | security.getUser |
Security_nofiles | security.nofiles |
Security_noforks | security.noforks |
セキュリティ_seccomp | セキュリティ.seccomp |
Security_setupComplete | security.setupComplete |
Security_setUser | security.setUser |
SessionManager_getHandles | sessionManager.getHandles |
sessionManager.getHandlesPages | |
SessionManager_sessionStats | sessionManager.sessionStats |
SwitchPinger_ping | switchPinger.ping |
UDPInterface_beginConnection | udpInterface.beginConnection |
UDPインターフェース_新規 | udpInterface.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