Important
the Common Name (CN) of the servers should be different from that of the CA. Otherwise, things won't work on servers that use OpenSSL.
// Package aria2ctrlfile implements [aria2]'s [control file format] (version 1). | |
// See https://github.com/aria2/aria2/blob/release-1.37.0/src/DefaultBtProgressInfoFile.cc | |
// for implementation details. | |
// | |
// [aria2]: https://github.com/aria2/aria2 | |
// [control file format]: https://aria2.github.io/manual/en/html/technical-notes.html#control-file-aria2-format | |
package aria2ctrlfile | |
import ( | |
"encoding/binary" |
import "math/bits" | |
func mulDiv(a, b, c int64) int64 { | |
hi, lo := bits.Mul64(uint64(a), uint64(b)) | |
quo, _ := bits.Div64(hi, lo, uint64(c)) | |
return int64(quo) | |
} |
package ringbuf | |
type RingBuf[T any] struct { | |
Buf []T | |
head int | |
tail int | |
} | |
func New[T any](size int) *RingBuf[T] { | |
return &RingBuf[T]{ |
#!/bin/bash | |
set -eu -o pipefail | |
# Script that returns a list of DNS-over-HTTPS servers that are accessible directly via IP address. | |
# https://dnscrypt.info/public-servers | |
# https://dnscrypt.info/stamps-specifications | |
main() | |
{ | |
VERBOSE=false |
func subsets[T any](v []T) [][]T { | |
switch len(v) { | |
case 0: | |
return [][]T{ | |
{}, | |
} | |
case 1: | |
return [][]T{ | |
{v[0]}, | |
{}, |
func permute[T any](v []T) [][]T { | |
switch len(v) { | |
case 0: | |
return [][]T{ | |
{}, | |
} | |
case 1: | |
return [][]T{ | |
{v[0]}, | |
} |
import "sync" | |
type Nuclear[T any] struct { | |
mu sync.RWMutex | |
v T | |
} | |
func NewNuclear[T any](v T) *Nuclear[T] { | |
return &Nuclear{ | |
v: v, |
package once | |
import "sync" | |
type Once[T any] struct { | |
sync.Mutex | |
has bool | |
v T | |
} |
package withcloser | |
import "io" | |
type reader struct { | |
io.Reader | |
close func() error | |
} | |
func (r reader) Close() error { |