This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Utils { | |
//ipv4的判断规则 | |
private static final Pattern IPV4 = Pattern.compile("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}"); | |
/** | |
* 这个过滤了 是回路的地址 | |
* | |
* */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# sudo ./install-shadowsocks-local-service.sh | |
cp shadowsocks-local.default /etc/default/shadowsocks-local | |
cp shadowsocks-local.init /etc/init.d/shadowsocks-local | |
chmod +x /etc/init.d/shadowsocks-local | |
ln -s ../init.d/shadowsocks-local /etc/rc0.d/K01shadowsocks-local | |
ln -s ../init.d/shadowsocks-local /etc/rc1.d/K01shadowsocks-local | |
ln -s ../init.d/shadowsocks-local /etc/rc2.d/K01shadowsocks-local | |
ln -s ../init.d/shadowsocks-local /etc/rc3.d/K01shadowsocks-local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv); |