当前位置: 首页>>代码示例>>Java>>正文


Java CircuitNode类代码示例

本文整理汇总了Java中com.subgraph.orchid.CircuitNode的典型用法代码示例。如果您正苦于以下问题:Java CircuitNode类的具体用法?Java CircuitNode怎么用?Java CircuitNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CircuitNode类属于com.subgraph.orchid包,在下文中一共展示了CircuitNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendRelayCellTo

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
void sendRelayCellTo(RelayCell cell, CircuitNode targetNode) {
	relaySendLock.lock();
	try {
		logRelayCell("Sending:     ", cell);
		cell.setLength();
		targetNode.updateForwardDigest(cell);
		cell.setDigest(targetNode.getForwardDigestBytes());

		for(CircuitNode node = targetNode; node != null; node = node.getPreviousNode())
			node.encryptForwardCell(cell);

		if(cell.getRelayCommand() == RelayCell.RELAY_DATA) 
			targetNode.waitForSendWindowAndDecrement();
		
		sendCell(cell);
	} finally {
		relaySendLock.unlock();
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:CircuitIO.java

示例2: sendRelayCellTo

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
void sendRelayCellTo(RelayCell cell, CircuitNode targetNode) {
	synchronized(relaySendLock) {
		logRelayCell("Sending:     ", cell);
		cell.setLength();
		targetNode.updateForwardDigest(cell);
		cell.setDigest(targetNode.getForwardDigestBytes());

		for(CircuitNode node = targetNode; node != null; node = node.getPreviousNode())
			node.encryptForwardCell(cell);

		if(cell.getRelayCommand() == RelayCell.RELAY_DATA) 
			targetNode.waitForSendWindowAndDecrement();
		
		sendCell(cell);
	}
}
 
开发者ID:HashEngineering,项目名称:quarkcoinj,代码行数:17,代码来源:CircuitIO.java

示例3: extendTo

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
CircuitNode extendTo() {
	final byte[] onion = kex.createOnionSkin();
	if(finalRouterSupportsExtend2()) {
		logger.fine("Extending circuit to "+ router.getNickname() + " with NTor inside RELAY_EXTEND2");
		return extendWithExtend2(onion);
	} else {
		logger.fine("Extending circuit to "+ router.getNickname() + " with NTor inside RELAY_EXTEND");
		return extendWithTunneledExtend(onion);
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:NTorCircuitExtender.java

示例4: processExtended2

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private CircuitNode processExtended2(RelayCell cell) {
	final int payloadLength = cell.getShort();
	if(payloadLength > cell.cellBytesRemaining()) {
		throw new TorException("Incorrect payload length value in RELAY_EXTENED2 cell");
	}
	byte[] payload = new byte[payloadLength];
	cell.getByteArray(payload);

	return processPayload(payload);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:NTorCircuitExtender.java

示例5: processPayload

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private CircuitNode processPayload(byte[] payload) {
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	final byte[] verifyDigest = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	if(!kex.deriveKeysFromHandshakeResponse(payload, keyMaterial, verifyDigest)) {
		return null;
	}
	return extender.createNewNode(router, keyMaterial, verifyDigest);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:NTorCircuitExtender.java

示例6: buildCircuit

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private void buildCircuit(Router firstRouter) throws TorException {
	notifyInitialization();
	final CircuitNode firstNode = extender.createFastTo(firstRouter);
	creationRequest.nodeAdded(firstNode);
	
	for(int i = 1; i < creationRequest.getPathLength(); i++) {
		final CircuitNode extendedNode = extender.extendTo(creationRequest.getPathElement(i));
		creationRequest.nodeAdded(extendedNode);
	}
	creationRequest.circuitBuildCompleted(circuit);
	notifyDone();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:13,代码来源:CircuitBuildTask.java

示例7: pathToString

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
protected String pathToString() {
	final StringBuilder sb = new StringBuilder();
	sb.append("[");
	for(CircuitNode node: nodeList) {
		if(sb.length() > 1)
			sb.append(",");
		sb.append(node.toString());
	}
	sb.append("]");
	return sb.toString();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:12,代码来源:CircuitImpl.java

示例8: RelayCellImpl

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
public RelayCellImpl(CircuitNode node, int circuit, int stream, int relayCommand, boolean isRelayEarly) {
	super(circuit, (isRelayEarly) ? (Cell.RELAY_EARLY) : (Cell.RELAY));
	this.circuitNode = node;
	this.relayCommand = relayCommand;
	this.streamId = stream;
	this.isOutgoing = true;
	putByte(relayCommand);	// Command
	putShort(0);			// 'Recognized'
	putShort(stream);		// Stream
	putInt(0);				// Digest
	putShort(0);			// Length	
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:13,代码来源:RelayCellImpl.java

示例9: CircuitNodeImpl

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private CircuitNodeImpl(Router router, CircuitNode previous, CircuitNodeCryptoState cryptoState) {
	previousNode = previous;
	this.router = router;
	this.cryptoState = cryptoState;
	windowLock = new Object();
	packageWindow = CIRCWINDOW_START;
	deliverWindow = CIRCWINDOW_START;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:CircuitNodeImpl.java

示例10: connectHiddenService

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
public HiddenServiceCircuit connectHiddenService(CircuitNode node) {
	if(type != InternalType.UNUSED) {
		throw new IllegalStateException("Cannot connect hidden service from internal circuit type "+ type);
	}
	appendNode(node);
	type = InternalType.HS_CIRCUIT;
	return this;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:InternalCircuitImpl.java

示例11: receiveAndProcessCreateFastResponse

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private CircuitNode receiveAndProcessCreateFastResponse(Router targetRouter, TorKeyAgreement kex) {
	final Cell cell = circuit.receiveControlCellResponse();
	if(cell == null) {
		throw new TorException("Timeout building circuit waiting for CREATE_FAST response from "+ targetRouter);
	}

	return processCreatedFastCell(targetRouter, cell, kex);
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:CircuitExtender.java

示例12: processCreatedFastCell

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private CircuitNode processCreatedFastCell(Router targetRouter, Cell cell, TorKeyAgreement kex) {
	final byte[] payload = new byte[TorMessageDigest.TOR_DIGEST_SIZE * 2];
	final byte[] keyMaterial = new byte[CircuitNodeCryptoState.KEY_MATERIAL_SIZE];
	final byte[] verifyHash = new byte[TorMessageDigest.TOR_DIGEST_SIZE];
	cell.getByteArray(payload);
	if(!kex.deriveKeysFromHandshakeResponse(payload, keyMaterial, verifyHash)) {
		// XXX
		return null;
	}
	final CircuitNode node = CircuitNodeImpl.createFirstHop(targetRouter, keyMaterial, verifyHash);
	circuit.appendNode(node);
	return node;
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:CircuitExtender.java

示例13: extendTo

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
CircuitNode extendTo(Router targetRouter) {
	if(circuit.getCircuitLength() == 0) {
		throw new TorException("Cannot EXTEND an empty circuit");
	}
	
	if(useNtor(targetRouter)) {
		final NTorCircuitExtender nce = new NTorCircuitExtender(this, targetRouter);
		return nce.extendTo();
	} else {
		final TapCircuitExtender tce = new TapCircuitExtender(this, targetRouter);
		return tce.extendTo();
	}
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:CircuitExtender.java

示例14: nodeToName

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
private String nodeToName(CircuitNode node) {
	if(node == null || node.getRouter() == null) {
		return "(null)";
	}
	final Router router = node.getRouter();
	return router.getNickname();
}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:CircuitExtender.java

示例15: createNewNode

import com.subgraph.orchid.CircuitNode; //导入依赖的package包/类
public CircuitNode createNewNode(Router r, byte[] keyMaterial, byte[] verifyDigest) {
	final CircuitNode node = CircuitNodeImpl.createNode(r, circuit.getFinalCircuitNode(), keyMaterial, verifyDigest);
	logger.fine("Adding new circuit node for "+ r.getNickname());
	circuit.appendNode(node);
	return node;

}
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:CircuitExtender.java


注:本文中的com.subgraph.orchid.CircuitNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。