-
enable NDP proxy at ocserv server host:
sysctl -w net.ipv6.conf.all.proxy_ndp=1. -
assign a sub network of ocserv server host IPv6 network for clients, for example:
if the IPv6 address of ocserv server host inteface eth0 is 2608:8207:7888:a450::1/64, then add the fellowing lines into ocserv.conf:
ipv6-network = 2608:8207:7888:a450:cafe::/80
This file contains hidden or 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
| import time | |
| from buf import HighFrequencyBuffer | |
| def test_throughput(): | |
| buffer = HighFrequencyBuffer() | |
| test_size = 100_000 | |
| # 写入性能 | |
| start = time.perf_counter() | |
| for i in range(test_size): |
This file contains hidden or 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
| import "github.com/go-playground/validator/v10" | |
| type Base struct { | |
| Name string `yaml:"name" validate:"required"` | |
| } | |
| type Ext struct { | |
| ID int `yaml:"id" validate:"gte=1,lt=10"` | |
| } |
This file contains hidden or 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
| Acquire::http::proxy "socks5h://127.0.0.1:1080"; | |
| Acquire::https::proxy "socks5h://127.0.0.1:1080"; |
This file contains hidden or 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/bash | |
| openssl req \ | |
| -new \ | |
| -newkey ec \ | |
| -pkeyopt ec_paramgen_curve:secp384r1 \ | |
| -sha256 \ | |
| -days 92 \ | |
| -nodes \ | |
| -x509 \ |
This file contains hidden or 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
| package main | |
| import ( | |
| "bytes" | |
| "image" | |
| "image/png" | |
| "io" | |
| "github.com/srwiley/oksvg" | |
| "github.com/srwiley/rasterx" |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "math" | |
| "runtime" | |
| "time" | |
| ) | |
| // Using the Bailey–Borwein–Plouffe formula |
This file contains hidden or 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
| mvfunc() { | |
| local original="$(declare -f $1)" | |
| local newname="$2${original#$1}" | |
| eval "${newname}" | |
| } |
This file contains hidden or 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
| authorityKeyIdentifier=keyid,issuer | |
| basicConstraints=CA:FALSE | |
| keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment | |
| extendedKeyUsage = serverAuth,clientAuth | |
| subjectAltName = @altnames | |
| [altnames] | |
| DNS.1 = localhost | |
| DNS.2 = 127.0.0.1 | |
| DNS.3 = ::1 |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # | |
| import ipaddress | |
| import re | |
| HEAD = re.compile('^(\|\|?)?(https?://)?') | |
| TAIL = re.compile('(/.*$)|(%2f.*$)|(%2F.*$)') |
NewerOlder