Firts you need to enable mod_openssl
/usr/sbin/lighttpd-enable-mod ssl
Then edit /etc/lighttpd/conf-enabled/10-ssl.conf :
vi /etc/lighttpd/conf-enabled/10-ssl.conf
Adjust to:
Firts you need to enable mod_openssl
/usr/sbin/lighttpd-enable-mod ssl
Then edit /etc/lighttpd/conf-enabled/10-ssl.conf :
vi /etc/lighttpd/conf-enabled/10-ssl.conf
Adjust to:
The Base64 url safe already supported by basenc
command. But it may be not pre-installed on many platfroms.
You can call base64
command but there is a pitfalls:
base64
command comes from coreutils
package. And it already have a basenc
commandbase64
is not installed by default and comes from coreutils-base64
package and the baseenc
command from coreutils-baseenc
base64
in BusyBox i.e. if you building the OpenWrt image yourself.openssl base64
or openssl enc -base64
see docs but it will read by lines so you must also specify -A
param.-d
decode flag must be in upper case base64 -D
so most users use --decode
flag. Previously MacOS used the -d
for debug but it's not clear who ever used it. Then Applce just removed the -d
param but again it's not clear why they don't changed it to be compatible with coreutilpackage main | |
// UInt16Slice is a sorted slice | |
type UInt16Slice []uint16 | |
// BinSearch binary search over the sorted sclice | |
func (a UInt16Slice) BinSearch(key uint16) int { | |
low := 0 | |
high := len(a) - 1 | |
for low <= high { |
package main | |
// parseIPv4 fast path clone of net.ParseIP that don't wrap IPv4 into IPv6 array | |
func parseIPv4(s string) []byte { | |
var p [4]byte | |
for i := 0; i < 4; i++ { | |
octet, pos := dtoi(s) | |
p[i] = octet | |
if i < 3 { | |
s = s[pos+1:] |
import ( | |
"github.com/prometheus/client_golang/prometheus" | |
"github.com/prometheus/client_golang/prometheus/promauto" | |
"google.golang.org/grpc/codes" | |
"google.golang.org/grpc/status" | |
"reflect" | |
"strconv" | |
) | |
// GrpcError The interface the same as internal type Error from grpc: internal/status/status.go |
// EncodeToJsonAsciiText Fast json text value encode: escape " with \" and \ with \\ | |
// Any non printable or Unicode chars will be removed. | |
// Please note that value is not enclosed into double quotes. | |
func EncodeToJsonAsciiText(plain string) string { | |
plainLen := len(plain) | |
newSize := plainLen | |
for i := 0; i < plainLen; i++ { | |
c := plain[i] | |
if c < 32 || c > 127 { // skip non printable and unicode | |
newSize-- |
package bytesmap | |
var m = make(map[string]*string) | |
// this works faster | |
func GetOrDefaultInline(host []byte) *string { | |
hc, found := m[string(host)] | |
if !found { | |
m[string(host)] = nil | |
} |
// IsIp checks that the given string is IPv4 or IPv6 address. | |
func IsIp(addr string) bool { | |
// IPv6 | |
if addr[0] == '[' { | |
return true | |
} | |
// domain can have digits, but it can't have ONLY digits | |
// So if all symbols are digits then this is an IPv4 address. We can check only first octet before dot . |