Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #25 from Srar/dev
Browse files Browse the repository at this point in the history
修正 #24
  • Loading branch information
Srar authored May 16, 2018
2 parents 6b57bb6 + fc7ad0e commit 2ff3f92
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion test/shadowsocks/crypto/CryptoTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ICryptoKeyIV from "./ICryptoKeyIV";
export default class CryptoTools {

public static generateKeyIVByPassword(passwordStr: string, keyLength: number, ivLength: number): ICryptoKeyIV {
var password: Buffer = new Buffer(passwordStr, "binary");
var password: Buffer = new Buffer(passwordStr.toString(), "binary");
var hashBuffers: Array<Buffer> = [];
for (var dataCount = 0, loopCount = 0; dataCount < keyLength + ivLength; loopCount++) {
var data: any = password;
Expand Down
22 changes: 12 additions & 10 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,18 @@ async function main() {

/* 设置OpenVPN网卡 */
if(!TAPControl.checkAdapterIsInstalled()) {
console.log("Installing driver...");
const result = TAPControl.installAdapter(path.join(process.cwd(), "driver/tapinstall.exe"));
if(result !== 0) {
console.error(`Driver was not successfully installed. Exit code: ${result}.`);
if(result === 2) {
console.log(`Please run as administrator.`);
}
process.exit(-1);
}
console.log("Install driver successfully.");
// console.log("Installing driver...");
// const result = TAPControl.installAdapter(path.join(process.cwd(), "driver/tapinstall.exe"));
// if(result !== 0) {
// console.error(`Driver was not successfully installed. Exit code: ${result}.`);
// if(result === 2) {
// console.log(`Please run as administrator.`);
// }
// process.exit(-1);
// }
// console.log("Install driver successfully.");
console.error("Please install openvpn tap driver.");
process.exit(-1);
}
const tapControl: TAPControl = TAPControl.init();
const tapInfo = tapControl.getAdapterInfo();
Expand Down

0 comments on commit 2ff3f92

Please sign in to comment.