JerryYuan 最近的时间轴更新
JerryYuan

JerryYuan

V2EX 第 657743 号会员,加入于 2023-11-01 17:08:44 +08:00
JerryYuan 最近回复了
1 天前
回复了 random1221 创建的主题 Linux centos 7 马上就停止维护了
所以 CentOS 到底哪里好用,这么多人用?
自打第一次用过 CentOS ,就被恶心到了,yum 装个啥都是个远古版本,想装新的就得冒依赖爆炸的风险自己去编译。然后就 ubuntu/debian apt 一把梭了
代理工作在 OSI 模型相当高的位置上,甚至能算到工作在 HTTP 协议层(应用层)之上。协议所在层动手脚只会影响工作在其上层的协议,不影响平级或底层的协议。
2 天前
回复了 13240284671 创建的主题 程序员 centos7 selenium 环境咋配置
docker 解君愁
32 天前
回复了 qaqLjj 创建的主题 问与答 你有哪些「这钱花的真他妈值」的瞬间
当年高中读了个私立高中,一年学费 8 千,三年老爹给花了 2 万 4 ,从中考 490 高中三年逆袭高考 640 ,出分那天老爹感叹到:"这 2w4 花的真值"
借楼问一下,这种门禁/楼宇对讲机有什么标准么,家里是个网线的,物业提供 POE 给对讲机供电和网络信号。
有个想法把这个网络接到自己的软路由里(会划一个独立的网络,防火墙堵死和内网的互联),软路由部署一个什么程序,可以代理那边的楼宇对讲流量和开门请求,虽然有一定的软件开发能力,但是不知道这玩意一般按什么通信标准,协议是啥,也就不知道应该从哪入手了。
40 天前
回复了 yeqizhang 创建的主题 Windows win10 关机是假关机吗?
@xmz8888 休眠应该是内存完整 dump 到磁盘,恢复时应用程序也都还在;假关机应该是只有内核或者系统必需的内存 dump 到磁盘,恢复时应用程序的内存已经没了,只能靠重新启动应用来恢复
74 天前
回复了 tool2dx 创建的主题 宽带症候群 网线的颜色顺序重要吗?
@tool2dx 最近刚自己做了个 PoE 受电的交换机,了解了一些 PoE 相关的知识。

其实网线并不是直接接到网络接口芯片上的,而是四对线通过四个变压器和网络接口出来的线耦合在一起。于是就实现了网线的电势可以随意变化(其实最后还是靠电阻和地有关联),对于它是 48V(poe)还是 0V(非供电)并不重要。于是就可以在网线的线对之间搞出一个电压用来供电,通过网络变压器以后,变化的网络信号和恒定的供电电压就隔离开了。

因为百兆只用四根线,于是另外四根线就可以抽走直接通个电压,这种就是非标的 PoE ,简单粗暴,一头通个 12V 48V 220V(很危险,但能用,且很受二把刀弱电师傅欢迎),另一头的设备直接受电就能用。

但是到了千兆,8 跟线都要跑数据信号,就没有空闲的线给供电用了,只能抽出两组(4 线)同时传信号和供电,再在网络变压器分离,网络变压器网线侧中间抽头出来电源,对侧线圈出来数据信号。这种也可以直接加电做非标的 PoE ,但是非标 PoE 相当于网口一直带电,有些隔离不好或者不支持非标 PoE 的口子还是有可能被高电压打坏接口。

于是引出了 IEEE 的标准 PoE ,即两边还要加电源管理芯片(供电端 PSE,受电端 PD),决定线上要不要带电。PD 会和 PSE 协商,然后 PSE 才会让网线带电,这种一般是 48V ,PSE 检测到对端不支持 PoE 的话是会关掉电源输出的。这种也是 PoE 交换机使用的 PoE 模式。
88 天前
回复了 BaymaxK 创建的主题 程序员 这愚人节彩蛋...
话说哦,设置中明确提供一个全局彩蛋开关是不是会更好呢(只提供全局开关,不提供具体彩蛋的开关和信息),另外触发彩蛋后 hover 能给个提示并一键关闭全局彩蛋开关。这样既能保留彩蛋,又可以在严肃场合提前/及时关掉彩蛋。
如 12#所说,改过一版,基本只替换了 luci 读配置那些东西。
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2018 Aleksandr V. Piskunov <[email protected]>.
# Copyright (C) 2015-2018 Jason A. Donenfeld <[email protected]>. All Rights Reserved.
#
# This watchdog script tries to re-resolve hostnames for inactive WireGuard peers.
# Use it for peers with a frequently changing dynamic IP.
# persistent_keepalive must be set, recommended value is 25 seconds.
#
# Run this script from cron every minute:
# echo '* * * * * /usr/bin/wireguard_watchdog' >> /etc/crontabs/root

check_peer_activity() {
local iface=$1
local public_key=$2
local endpoint_host=$3
local endpoint_port=$4
local persistent_keepalive
local last_handshake
local idle_seconds

persistent_keepalive=$(wg show ${iface} persistent-keepalive | grep ${public_key} | awk '{print $2}')

echo "checking $1 $2 $3 $4..."

# only process peers with endpoints and keepalive set
echo 1
[ -z ${endpoint_host} ] && return 0;
echo 2
[ -z ${persistent_keepalive} -o ${persistent_keepalive} = "off" ] && return 0;
echo 3

# skip IP addresses
# check taken from packages/net/ddns-scripts/files/dynamic_dns_functions.sh
local IPV4_REGEX="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
local IPV6_REGEX="\(\([0-9A-Fa-f]\{1,4\}:\)\{1,\}\)\(\([0-9A-Fa-f]\{1,4\}\)\{0,1\}\)\(\(:[0-9A-Fa-f]\{1,4\}\)\{1,\}\)"
local IPV4=$(echo ${endpoint_host} | grep -m 1 -o "$IPV4_REGEX$") # do not detect ip in 0.0.0.0.example.com
local IPV6=$(echo ${endpoint_host} | grep -m 1 -o "$IPV6_REGEX")
echo 4
[ -n "${IPV4}" -o -n "${IPV6}" ] && return 0;
echo 5

# re-resolve endpoint hostname if not responding for too long
last_handshake=$(wg show ${iface} latest-handshakes | grep ${public_key} | awk '{print $2}')
[ -z ${last_handshake} ] && return 0;
idle_seconds=$(($(date +%s)-${last_handshake}))
[ ${idle_seconds} -lt 150 ] && return 0;
logger -t "wireguard_monitor" "${iface} endpoint ${endpoint_host}:${endpoint_port} is not responding for ${idle_seconds} seconds, trying to re-resolve hostname"
wg set ${iface} peer ${public_key} endpoint "${endpoint_host}:${endpoint_port}"
}

# query ubus for all active wireguard interfaces
wg_ifaces=$(wg show interfaces | awk '{print $1}' | tr '\n' ' ')

# check every peer in every active wireguard interface
for iface in $wg_ifaces; do
config_file="/etc/wireguard/${iface}.conf"
# parsing wireguard config file
eval `cat $config_file | tr -d ' ' |awk -F '=' '
BEGIN {peer_index = 0;status = 0;}
# close previous peer section
status==1 && $1 ~ /^\[/ {status = 0;}
# open new peer section
status==0 && $1 == "[Peer]" {status = 1;peer_index++;}
# parse PublicKey in Peer section
status==1 && $1 == "PublicKey" {public_key = \$0;sub(/PublicKey=/, "", public_key);printf("public_key%d=%s\n", peer_index, public_key);}
# parse Endpoint in Peer section
status==1 && $1 == "Endpoint" {printf("endpoint%d=%s\n", peer_index, $2);}
END {printf("peer_count=%d\n",peer_index)}'`

for ((i = 1; i <= $peer_count; i++)); do
public_key_var="public_key$i"
endpoint_var="endpoint$i"
public_key="${!public_key_var}"
endpoint="${!endpoint_var}"

endpoint_host=`echo "${endpoint}"|awk -F '[:]' '{print $1}'`
endpoint_port=`echo "${endpoint}"|awk -F '[:]' '{print $2}'`
check_peer_activity "${iface}" "${public_key}" "${endpoint_host}" "${endpoint_port}"
done
done
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1083 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 23:49 · PVG 07:49 · LAX 16:49 · JFK 19:49
Developed with CodeLauncher
♥ Do have faith in what you're doing.