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.async활성화 |
Admin_available함수 | admin.available함수 |
admin.availableFunctionsPaged | |
AdminLog_logMany | log.logMany |
AdminLog_subscribe | 로그.구독 |
AdminLog_subscriptions | 로그.구독 |
AdminLog_unsubscribe | 로그.구독 취소 |
Allocator_bytes할당됨 | 할당자.바이트할당됨 |
Allocator_snapshot | 할당자.스냅샷 |
승인된 비밀번호_add | 승인된 비밀번호.추가 |
승인된 비밀번호_목록 | 승인된 비밀번호.목록 |
승인된 비밀번호_remove | 승인된 비밀번호.제거 |
Core_exit | 코어.종료 |
Core_initTunnel | core.initTunnel |
Core_pid | core.pid |
InterfaceController_disconnectPeer | 인터페이스컨트롤러.disconnectPeer |
InterfaceController_peerStats | 인터페이스컨트롤러.peerStats |
인터페이스컨트롤러.peerStatsPaged | |
IpTunnel_allowConnection | ipTunnel.allowConnection |
IpTunnel_connectTo | ipTunnel.connectTo |
IpTunnel_listConnections | ipTunnel.list연결 |
IpTunnel_removeConnection | ipTunnel.removeConnection |
IpTunnel_showConnection | ipTunnel.showConnection |
Janitor_dumpRumorMill | janitor.dumpRumorMill |
메모리 | 관리자.메모리 |
nodeStore.dumpTablePaged | |
NodeStore_getLink | nodeStore.getLink |
NodeStore_getRouteLabel | nodeStore.getRouteLabel |
NodeStore_nodeForAddr | nodeStore.nodeForAddr |
핑 | admin.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 | 보안.chroot |
Security_getUser | security.getUser |
Security_nofiles | security.nofiles |
Security_noforks | security.noforks |
Security_seccomp | security.seccomp |
Security_setup완료 | security.setup완료 |
Security_setUser | security.set사용자 |
SessionManager_getHandles | sessionManager.getHandles |
sessionManager.getHandlesPaged | |
SessionManager_sessionStats | sessionManager.sessionStats |
SwitchPinger_ping | switchPinger.ping |
UDPInterface_beginConnection | udpInterface.beginConnection |
UDPInterface_new | 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