穿透技术
FRP用户手册
FRP服务端
# 该配置文件仅供参考,请勿直接使用运行程序,可能会存在各种问题。
# 对于 IPv6 地址或主机名,必须使用方括号括起来,例如 "[::1]:80"、"[ipv6-host]:http" 或 "[ipv6-host%zone]:80"
# 对于单个 "bindAddr" 字段,不需要使用方括号,例如 bindAddr = "::"。
bindAddr = "0.0.0.0"
bindPort = 7000
# UDP 端口,用于 KCP 协议。可以与 'bindPort' 相同。
# 如果未设置,则 frps 中禁用 KCP。
kcpBindPort = 7000
# UDP 端口,用于 QUIC 协议。
# 如果未设置,则 frps 中禁用 QUIC。
# quicBindPort = 7002
# 指定代理监听的地址,默认值与 bindAddr 相同。
# proxyBindAddr = "127.0.0.1"
# QUIC 协议配置选项
# transport.quic.keepalivePeriod = 10
# transport.quic.maxIdleTimeout = 30
# transport.quic.maxIncomingStreams = 100000
# 心跳配置,不建议修改默认值。
# 默认的 heartbeatTimeout 为 90。设置为负值可禁用它。
# transport.heartbeatTimeout = 90
# 每个代理中保留的连接池数量不超过 maxPoolCount。
transport.maxPoolCount = 5
# 是否使用 TCP 流多路复用,默认为 true。
# transport.tcpMux = true
# 指定 TCP 多路复用的保持连接时间间隔。
# 仅在 tcpMux 为 true 时有效。
# transport.tcpMuxKeepaliveInterval = 30
# tcpKeepalive 指定 frpc 和 frps 之间活动网络连接的保持存活探测间隔。
# 如果为负数,则禁用保持存活探测。
# transport.tcpKeepalive = 7200
# transport.tls.force 指定是否仅接受 TLS 加密连接。默认值为 false。
transport.tls.force = false
# transport.tls.certFile = "server.crt"
# transport.tls.keyFile = "server.key"
# transport.tls.trustedCaFile = "ca.crt"
# 如果希望支持虚拟主机,必须设置监听的 HTTP 端口(可选)。
# 注意:HTTP 端口和 HTTPS 端口可以与 bindPort 相同。
vhostHTTPPort = 80
vhostHTTPSPort = 443
# 虚拟主机 HTTP 服务器的响应头超时时间(秒),默认为 60 秒。
# vhostHTTPTimeout = 60
# tcpmuxHTTPConnectPort 指定服务器监听 TCP HTTP CONNECT 请求的端口。
# 如果值为 0,服务器不会在单一端口上多路复用 TCP 请求。否则,它会监听这个值所指定的端口。
# 默认为 0。
# tcpmuxHTTPConnectPort = 1337
# 如果 tcpmuxPassthrough 为 true,frps 不会对流量进行任何更新。
# tcpmuxPassthrough = false
# 配置 Web 服务器以启用 frps 的仪表板。
# 仅在设置了 webServer.port 时,仪表板可用。
webServer.addr = "127.0.0.1"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"
# webServer.tls.certFile = "server.crt"
# webServer.tls.keyFile = "server.key"
# 仪表板静态资源目录(仅用于调试模式)
# webServer.assetsDir = "./static"
# 在仪表板监听器中启用 golang pprof 处理程序。
# 必须首先设置仪表板端口。
webServer.pprofEnable = false
# enablePrometheus 将在 /metrics API 上通过 webServer 导出 prometheus 指标。
enablePrometheus = true
# 日志输出位置,可以是控制台或文件路径,如 "./frps.log"
log.to = "./frps.log"
# 日志级别:trace, debug, info, warn, error
log.level = "info"
log.maxDays = 3
# 当 log.to 为控制台时,禁用日志颜色输出,默认值为 false
log.disablePrintColor = false
# DetailedErrorsToClient 定义是否向 frpc 发送具体错误(包含调试信息)。默认值为 true。
detailedErrorsToClient = true
# auth.method 指定用于验证 frpc 和 frps 的认证方法。
# 如果指定为 "token",则会在登录消息中读取 token。
# 如果指定为 "oidc",则会使用 OIDC 设置发出 OIDC 令牌。默认值为 "token"。
auth.method = "token"
# auth.additionalScopes 指定包含认证信息的额外范围。
# 可选值为 HeartBeats, NewWorkConns。
# auth.additionalScopes = ["HeartBeats", "NewWorkConns"]
# 认证 token
auth.token = "12345678"
# oidc 发行者指定用于验证 OIDC 令牌的发行者。
auth.oidc.issuer = ""
# oidc 受众指定在验证 OIDC 令牌时应包含的受众。
auth.oidc.audience = ""
# oidc skipExpiryCheck 指定是否跳过检查 OIDC 令牌是否过期。
auth.oidc.skipExpiryCheck = false
# oidc skipIssuerCheck 指定是否跳过检查 OIDC 令牌的发行者声明是否与 oidcIssuer 指定的发行者匹配。
auth.oidc.skipIssuerCheck = false
# userConnTimeout 指定工作连接的最大等待时间。
# userConnTimeout = 10
# 仅允许 frpc 绑定指定的端口。默认情况下没有限制。
allowPorts = [
{ start = 2000, end = 3000 },
{ single = 3001 },
{ single = 3003 },
{ start = 4000, end = 50000 }
]
# 每个客户端可使用的最大端口数,默认为 0 表示无限制。
maxPortsPerClient = 0
# 如果 subDomainHost 不为空,则在 frpc 配置文件中使用 http 或 https 类型时,可以设置子域名。
# 当子域名为 test 时,用于路由的主机是 test.frps.com。
subDomainHost = "frps.com"
# HTTP 请求的自定义 404 页面
# custom404Page = "/path/to/404.html"
# 指定 UDP 包大小,单位为字节。如果未设置,默认值为 1500。
# 该参数应在客户端和服务器之间保持一致。
# 它影响 UDP 和 SUDP 代理。
udpPacketSize = 1500
# NAT 穿透策略数据的保留时间。
natholeAnalysisDataReserveHours = 168
# SSH 隧道网关
# 如果要启用此功能,bindPort 参数是必需的,其他为可选。
# 默认情况下,此功能是禁用的。当 bindPort 大于 0 时将启用它。
# sshTunnelGateway.bindPort = 2200
# sshTunnelGateway.privateKeyFile = "/home/frp-user/.ssh/id_rsa"
# sshTunnelGateway.autoGenPrivateKeyPath = ""
# sshTunnelGateway.authorizedKeysFile = "/home/frp-user/.ssh/authorized_keys"
[[httpPlugins]]
name = "user-manager"
addr = "127.0.0.1:9000"
path = "/handler"
ops = ["Login"]
[[httpPlugins]]
name = "port-manager"
addr = "127.0.0.1:9001"
path = "/handler"
ops = ["NewProxy"]
FRP客户端
# 此配置文件仅供参考,请勿直接使用此配置运行程序,可能会有各种问题。
# 您的代理名称将更改为 {user}.{proxy}
user = "your_name"
# 对于IPv6的字面地址或主机名,必须用方括号括起来,如 "[::1]:80", "[ipv6-host]:http" 或 "[ipv6-host%zone]:80"
# 对于单一的 serverAddr 字段,不需要方括号,例如 serverAddr = "::"。
serverAddr = "0.0.0.0"
serverPort = 7000
# STUN服务器,用于帮助穿透NAT。
# natHoleStunServer = "stun.easyvoip.com:3478"
# 决定在首次登录失败时是否退出程序,否则将连续重新登录frps
# 默认为 true
loginFailExit = true
# 日志输出位置,可设置为控制台或实际的日志文件路径,例如 ./frpc.log
log.to = "./frpc.log"
# 日志级别,可设置为 trace, debug, info, warn, error
log.level = "info"
# 日志保留天数
log.maxDays = 3
# 当 log.to 设置为控制台时,是否禁用日志颜色,默认值为 false
log.disablePrintColor = false
# 认证方法
auth.method = "token"
# auth.additionalScopes 指定附加的作用域以包含认证信息。
# 可选值为 HeartBeats, NewWorkConns。
# auth.additionalScopes = ["HeartBeats", "NewWorkConns"]
# 认证的 token
auth.token = "12345678"
# oidc.clientID 指定用于获取OIDC认证token的客户端ID。
# auth.oidc.clientID = ""
# oidc.clientSecret 指定用于获取OIDC认证token的客户端密钥。
# auth.oidc.clientSecret = ""
# oidc.audience 指定OIDC认证的受众。
# auth.oidc.audience = ""
# oidc.scope 指定在认证方法为 OIDC 时的token权限。默认值为 ""。
# auth.oidc.scope = ""
# oidc.tokenEndpointURL 指定实现OIDC Token端点的URL,用于获取OIDC token。
# auth.oidc.tokenEndpointURL = ""
# oidc.additionalEndpointParams 指定发送给OIDC Token端点的附加参数。
# 例如,如果您想指定"audience"参数,可以设置如下。
# frp将添加 "audience=<value>" "var1=<value>" 到附加参数中。
# auth.oidc.additionalEndpointParams.audience = "https://dev.auth.com/api/v2/"
# auth.oidc.additionalEndpointParams.var1 = "foobar"
# 设置管理控制台地址,用于通过HTTP API控制frpc的行为,例如重新加载
webServer.addr = "127.0.0.1"
webServer.port = 7400
webServer.user = "admin"
webServer.password = "admin"
# 管理控制台的静态资源目录。默认情况下,这些资源与frpc捆绑在一起。
# webServer.assetsDir = "./static"
# 在管理监听器中启用golang pprof处理程序。
webServer.pprofEnable = false
# 指定与服务器连接的最大拨号时间,默认为10秒。
# transport.dialServerTimeout = 10
# dialServerKeepalive 指定frpc与frps之间活跃网络连接的保活探测间隔。如果为负值,则禁用保活探测。
# transport.dialServerKeepalive = 7200
# 提前建立的连接数,默认值为0
transport.poolCount = 5
# 如果使用TCP流多路复用,默认值为 true,必须与frps一致
# transport.tcpMux = true
# 指定TCP多路复用的保活间隔,仅在tcpMux启用时有效。
# transport.tcpMuxKeepaliveInterval = 30
# 连接服务器时使用的通信协议
# 目前支持 tcp, kcp, quic, websocket 和 wss,默认是 tcp
transport.protocol = "tcp"
# 设置客户端绑定的IP地址用于连接服务器,默认为空。
# 仅在 protocol = tcp 或 websocket 时,该值才会被使用。
transport.connectServerLocalIP = "0.0.0.0"
# 如果您想通过HTTP代理、SOCKS5代理或NTLM代理连接frps,可以在这里或在全局环境变量中设置proxyURL
# 仅在 protocol 为 tcp 时有效
# transport.proxyURL = "http://user:passwd@192.168.1.128:8080"
# transport.proxyURL = "socks5://user:passwd@192.168.1.128:1080"
# transport.proxyURL = "ntlm://user:passwd@192.168.1.128:2080"
# QUIC协议选项
# transport.quic.keepalivePeriod = 10
# transport.quic.maxIdleTimeout = 30
# transport.quic.maxIncomingStreams = 100000
# 如果 tls.enable 为 true,frpc 将通过 TLS 连接 frps。
# 自v0.50.0起,默认值已更改为true,TLS默认启用。
transport.tls.enable = true
# transport.tls.certFile = "client.crt"
# transport.tls.keyFile = "client.key"
# transport.tls.trustedCaFile = "ca.crt"
# transport.tls.serverName = "example.com"
# 如果 disableCustomTLSFirstByte 设置为 false,启用 TLS 时,frpc 将使用第一个自定义字节与 frps 建立连接。
# 自v0.50.0起,默认值已更改为true,第一个自定义字节默认禁用。
# transport.tls.disableCustomTLSFirstByte = true
# 心跳配置,不建议修改默认值。
# heartbeatInterval 的默认值为10,heartbeatTimeout 为90。设置负值可禁用心跳。
# transport.heartbeatInterval = 30
# transport.heartbeatTimeout = 90
# 指定 DNS 服务器,frpc 将使用该服务器而非默认的
# dnsServer = "8.8.8.8"
# 要启动的代理名称,默认为空,表示启动所有代理。
# start = ["ssh", "dns"]
# 指定UDP包大小,单位为字节。如果未设置,默认值为1500。
# 此参数在客户端和服务器之间应保持一致,影响UDP和SUDP代理。
udpPacketSize = 1500
# 客户端的附加元数据。
metadatas.var1 = "abc"
metadatas.var2 = "123"
# 包含其他代理配置文件。
# includes = ["./confd/*.ini"]
花生壳用户手册
https://hsk.oray.com/download/
免费DDNS
端口映射
代理技术
Nginx反向代理
Nginx配置详解
# Nginx配置文件nginx.conf中文详解
# 定义Nginx运行的用户和用户组
user www www;
# nginx进程数,建议设置为等于CPU总核心数
worker_processes 8;
# 全局错误日志定义类型,[ debug | info | notice | warn | error | crit ]
error_log /usr/local/nginx/logs/error.log info;
# 进程pid文件
pid /usr/local/nginx/logs/nginx.pid;
# 指定进程可以打开的最大描述符数目
# 工作模式与连接数上限
# 理论值应该是最多打开文件数(ulimit -n)与nginx进程数相除
# 现在在linux 2.6内核下开启文件打开数为65535
worker_rlimit_nofile 65535;
events {
# 参考事件模型,use [ kqueue | rtsig | epoll | /dev/poll | select | poll ]
# epoll模型是Linux 2.6以上版本内核中的高性能网络I/O模型
use epoll;
# 单个进程最大连接数(最大连接数=连接数*进程数)
worker_connections 65535;
# keepalive超时时间
keepalive_timeout 60;
# 客户端请求头部的缓冲区大小
client_header_buffer_size 4k;
# 文件缓存配置
open_file_cache max=65535 inactive=60s;
open_file_cache_valid 80s;
open_file_cache_min_uses 1;
open_file_cache_errors on;
}
# 设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
# 文件扩展名与文件类型映射表
include mime.types;
# 默认文件类型
default_type application/octet-stream;
# 服务器名字的hash表大小
server_names_hash_bucket_size 128;
# 客户端请求头部的缓冲区大小
client_header_buffer_size 32k;
large_client_header_buffers 4 64k;
# 设定通过nginx上传文件的大小
client_max_body_size 8m;
# 开启高效文件传输模式
sendfile on;
tcp_nopush on;
tcp_nodelay on;
# 长连接超时时间,单位是秒
keepalive_timeout 120;
# FastCGI相关参数
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
# gzip模块设置
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
# 负载均衡配置
upstream backend {
# upstream的负载均衡,weight是权重
server 192.168.80.121:80 weight=3;
server 192.168.80.122:80 weight=2;
server 192.168.80.123:80 weight=3;
}
# 虚拟主机的配置
server {
# 监听端口
listen 80;
# 域名可以有多个,用空格隔开
server_name www.w3cschool.cn w3cschool.cn;
index index.html index.htm index.php;
root /data/www/w3cschool;
# 对PHP文件进行负载均衡
location ~ .*.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
# 图片缓存时间设置
location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 10d;
}
# JS和CSS缓存时间设置
location ~ .*.(js|css)?$ {
expires 1h;
}
# 日志格式设定
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
# 定义本虚拟主机的访问日志
access_log /usr/local/nginx/logs/host.access.log main;
access_log /usr/local/nginx/logs/host.access.404.log log404;
# 反向代理配置
location / {
proxy_pass http://127.0.0.1:88;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# 允许客户端请求的最大单文件字节数
client_max_body_size 10m;
client_body_buffer_size 128k;
# 代理超时设置
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
# 代理缓冲区设置
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
# Nginx状态监控
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
auth_basic_user_file confpasswd;
}
# 静态文件处理
location ~ .*.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$ {
expires 15d;
}
}
}
Clash Verge正向代理
https://github.com/clash-verge-rev/clash-verge-rev
OpenWRT路由器
OpenWRT配置 clash
https://linhongbo.com/posts/how-to-use-clash-on-openwrt/
OpenWRT DDNS+端口映射
https://blog.csdn.net/weixin_42708321/article/details/114342581
OpenWRT设置旁路由
https://blog.csdn.net/weixin_42708321/article/details/124720849