本文整理汇总了Java中com.subgraph.orchid.Tor类的典型用法代码示例。如果您正苦于以下问题:Java Tor类的具体用法?Java Tor怎么用?Java Tor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tor类属于com.subgraph.orchid包,在下文中一共展示了Tor类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: connectSocket
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private void connectSocket() throws IOException {
if(initializationTracker != null) {
if(isDirectoryConnection) {
initializationTracker.notifyEvent(Tor.BOOTSTRAP_STATUS_CONN_DIR);
} else {
initializationTracker.notifyEvent(Tor.BOOTSTRAP_STATUS_CONN_OR);
}
}
socket.connect(routerToSocketAddress(router), DEFAULT_CONNECT_TIMEOUT);
if(initializationTracker != null) {
if(isDirectoryConnection) {
initializationTracker.notifyEvent(Tor.BOOTSTRAP_STATUS_HANDSHAKE_DIR);
} else {
initializationTracker.notifyEvent(Tor.BOOTSTRAP_STATUS_HANDSHAKE_OR);
}
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:20,代码来源:ConnectionImpl.java
示例2: toBase64
import com.subgraph.orchid.Tor; //导入依赖的package包/类
public String toBase64(boolean stripTrailingEquals) {
final String b64 = new String(Base64.encode(digestBytes), Tor.getDefaultCharset());
if(stripTrailingEquals) {
return stripTrailingEquals(b64);
} else {
return b64;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:9,代码来源:HexDigest.java
示例3: getRawDocumentBytes
import com.subgraph.orchid.Tor; //导入依赖的package包/类
public ByteBuffer getRawDocumentBytes() {
if(getRawDocumentData() == null) {
return ByteBuffer.allocate(0);
} else {
return ByteBuffer.wrap(getRawDocumentData().getBytes(Tor.getDefaultCharset()));
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:KeyCertificateImpl.java
示例4: createGuardEntryFor
import com.subgraph.orchid.Tor; //导入依赖的package包/类
public GuardEntry createGuardEntryFor(Router router) {
final GuardEntryImpl entry = new GuardEntryImpl(directory, this, router.getNickname(), router.getIdentityHash().toString());
final String version = Tor.getImplementation() + "-" + Tor.getVersion();
entry.setVersion(version);
/*
* "Choose expiry time smudged over the last month."
*
* See add_an_entry_guard() in entrynodes.c
*/
final long createTime = (new Date()).getTime() - (random.nextInt(3600 * 24 * 30) * 1000L);
entry.setCreatedTime(new Date(createTime));
return entry;
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:15,代码来源:StateFile.java
示例5: getFileContents
import com.subgraph.orchid.Tor; //导入依赖的package包/类
ByteBuffer getFileContents() {
final StringBuilder sb = new StringBuilder();
synchronized (guardEntries) {
for(GuardEntryImpl entry: guardEntries) {
sb.append(entry.writeToString());
}
}
return ByteBuffer.wrap(sb.toString().getBytes(Tor.getDefaultCharset()));
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:10,代码来源:StateFile.java
示例6: purposeToEventCode
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private int purposeToEventCode(int purpose, boolean getLoadingEvent) {
switch(purpose) {
case CircuitManager.DIRECTORY_PURPOSE_CONSENSUS:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_STATUS : Tor.BOOTSTRAP_STATUS_REQUESTING_STATUS;
case CircuitManager.DIRECTORY_PURPOSE_CERTIFICATES:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_KEYS : Tor.BOOTSTRAP_STATUS_REQUESTING_KEYS;
case CircuitManager.DIRECTORY_PURPOSE_DESCRIPTORS:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_DESCRIPTORS : Tor.BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS;
default:
return 0;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:13,代码来源:DirectoryDocumentRequestor.java
示例7: initialize
import com.subgraph.orchid.Tor; //导入依赖的package包/类
void initialize() {
final StringBuilder builder = new StringBuilder();
for(String entry: dirServers) {
builder.append(entry);
builder.append('\n');
}
final ByteBuffer buffer = ByteBuffer.wrap(builder.toString().getBytes(Tor.getDefaultCharset()));
final DocumentFieldParser parser = new DocumentFieldParserImpl(buffer);
parser.setHandler(new DocumentParsingHandler() {
public void endOfDocument() {}
public void parseKeywordLine() { processKeywordLine(parser);}
});
parser.processDocument();
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:16,代码来源:TrustedAuthorities.java
示例8: notifyInitialization
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private void notifyInitialization() {
if(initializationTracker != null) {
final int event = creationRequest.isDirectoryCircuit() ?
Tor.BOOTSTRAP_STATUS_ONEHOP_CREATE : Tor.BOOTSTRAP_STATUS_CIRCUIT_CREATE;
initializationTracker.notifyEvent(event);
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:8,代码来源:CircuitBuildTask.java
示例9: purposeToEventCode
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private int purposeToEventCode(int purpose, boolean getLoadingEvent) {
switch(purpose) {
case DIRECTORY_PURPOSE_CONSENSUS:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_STATUS : Tor.BOOTSTRAP_STATUS_REQUESTING_STATUS;
case DIRECTORY_PURPOSE_CERTIFICATES:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_KEYS : Tor.BOOTSTRAP_STATUS_REQUESTING_KEYS;
case DIRECTORY_PURPOSE_DESCRIPTORS:
return getLoadingEvent ? Tor.BOOTSTRAP_STATUS_LOADING_DESCRIPTORS : Tor.BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS;
default:
return 0;
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:13,代码来源:CircuitManagerImpl.java
示例10: createSocketInstance
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private Socket createSocketInstance() throws SocketException {
final OrchidSocketImpl impl = new OrchidSocketImpl(torClient);
if(Tor.isAndroidRuntime()) {
return new AndroidSocket(impl);
} else {
// call protected constructor
return new Socket(impl) {};
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:10,代码来源:OrchidSocketFactory.java
示例11: createSSLSocketFactory
import com.subgraph.orchid.Tor; //导入依赖的package包/类
private SSLSocketFactory createSSLSocketFactory() {
if(Tor.isAndroidRuntime()) {
return createAndroidSSLSocketFactory();
}
if(sslContext == null) {
return (SSLSocketFactory) SSLSocketFactory.getDefault();
} else {
return sslContext.getSocketFactory();
}
}
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:11,代码来源:OrchidXmlRpcTransport.java
注:本文中的com.subgraph.orchid.Tor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论