新手运行项目遇到问题
没有了解过 go ,今天需要运行一个 go 的程序,按照这个教程 https://www.bt.cn/bbs/thread-17882-1-1.html 部署了环境一切正常,但是运行:go run main.go 的时候,出现如下的问题:
main.go:23:2: no required module provides package github.com/shirou/gopsutil/cpu: go.mod file not found in current directory or any parent directory; see 'go help modules'
main.go:24:2: no required module provides package github.com/shirou/gopsutil/mem: go.mod file not found in current directory or any parent directory; see 'go help modules'
main.go:25:2: no required module provides package github.com/shirou/gopsutil/net: go.mod file not found in current directory or any parent directory; see 'go help modules'
输入:go help modules 后提示如下
Modules are how Go manages dependencies.
A module is a collection of packages that are released, versioned, and
distributed together. Modules may be downloaded directly from version control
repositories or from module proxy servers.
For a series of tutorials on modules, see
https://golang.org/doc/tutorial/create-module.
For a detailed reference on modules, see https://golang.org/ref/mod.
By default, the go command may download modules from https://proxy.golang.org.
It may authenticate modules using the checksum database at
https://sum.golang.org. Both services are operated by the Go team at Google.
The privacy policies for these services are available at
https://proxy.golang.org/privacy and https://sum.golang.org/privacy,
respectively.
The go command's download behavior may be configured using GOPROXY, GOSUMDB,
GOPRIVATE, and other environment variables. See 'go help environment'
and https://golang.org/ref/mod#private-module-privacy for more information.
希望大伙可以帮一下我,谢谢。
#go #https #modules #module #golang #org #directory #mod #see #help
没有了解过 go ,今天需要运行一个 go 的程序,按照这个教程 https://www.bt.cn/bbs/thread-17882-1-1.html 部署了环境一切正常,但是运行:go run main.go 的时候,出现如下的问题:
main.go:23:2: no required module provides package github.com/shirou/gopsutil/cpu: go.mod file not found in current directory or any parent directory; see 'go help modules'
main.go:24:2: no required module provides package github.com/shirou/gopsutil/mem: go.mod file not found in current directory or any parent directory; see 'go help modules'
main.go:25:2: no required module provides package github.com/shirou/gopsutil/net: go.mod file not found in current directory or any parent directory; see 'go help modules'
输入:go help modules 后提示如下
Modules are how Go manages dependencies.
A module is a collection of packages that are released, versioned, and
distributed together. Modules may be downloaded directly from version control
repositories or from module proxy servers.
For a series of tutorials on modules, see
https://golang.org/doc/tutorial/create-module.
For a detailed reference on modules, see https://golang.org/ref/mod.
By default, the go command may download modules from https://proxy.golang.org.
It may authenticate modules using the checksum database at
https://sum.golang.org. Both services are operated by the Go team at Google.
The privacy policies for these services are available at
https://proxy.golang.org/privacy and https://sum.golang.org/privacy,
respectively.
The go command's download behavior may be configured using GOPROXY, GOSUMDB,
GOPRIVATE, and other environment variables. See 'go help environment'
and https://golang.org/ref/mod#private-module-privacy for more information.
希望大伙可以帮一下我,谢谢。
#go #https #modules #module #golang #org #directory #mod #see #help
你的 Surge for Mac 的最佳实践是?
入手 Surge 有一段时间, 断断续续了解了一些特性。但是自己对 Profile ,Module 的使用没有很轻松掌握。
譬如,从远端安装的 Profile 可以自动更新,但是不能作修改。如果复制一份远端的 Profile ,怎样让也能自动更新?
各位是怎样使用 Surge 的?有没有什么经验可以分享(有其实 Profile ,Module 这一块)
目前自己也用 Surge 做了网关。
也使用了一段时间的 DHCP Server 功能,但是感觉不是很习惯,奇怪的一点是设备实际的 IP 地址和在 Surge 中看到的 IP 地址不相同...后来还是关掉了。
#Surge #Profile #自动更新 #Module #IP #地址 #使用 #一段时间 #但是 #网关
入手 Surge 有一段时间, 断断续续了解了一些特性。但是自己对 Profile ,Module 的使用没有很轻松掌握。
譬如,从远端安装的 Profile 可以自动更新,但是不能作修改。如果复制一份远端的 Profile ,怎样让也能自动更新?
各位是怎样使用 Surge 的?有没有什么经验可以分享(有其实 Profile ,Module 这一块)
目前自己也用 Surge 做了网关。
也使用了一段时间的 DHCP Server 功能,但是感觉不是很习惯,奇怪的一点是设备实际的 IP 地址和在 Surge 中看到的 IP 地址不相同...后来还是关掉了。
#Surge #Profile #自动更新 #Module #IP #地址 #使用 #一段时间 #但是 #网关
M1 MacBook Air 播放 YouTube TV 的 4K 直播非常流畅,但是 11 代低压 U 下却会时常卡顿
之前发过一帖进行讨论: https://www.v2ex.com/t/871652 ,@Satelli 回复说是 Widevine Content Decryption Module 的问题,前两天测试发现确实如此,在浏览器播放 YouTube TV 内容( DRM 内容)时,Widevine CDM 会占用非常多的 CPU 资源,总体占用在 i5-1135G7 上会直接到 100%,在 M1 MacBook Air 上会到 150%-180%,都非常恐怖。( Chrome 和 Edge 均测试)
有讨论这个问题是前几天在浏览 Chrome 107 支持 HEVC 硬解的文章时,看到了 Widevine CDM 将被弃用,Chrome 107 已经内置了一种新的 CDM ,目前讨论还很少,还不到新的 CDM 如何启用,对系统资源占用过多是否有改善。这对于浏览器网页观看 Netflix ,Disney+不知道有多大影响。
相关链接: https://www.xda-developers.com/google-is-deprecating-widevine-for-chromium/
另外 Windows 版的 Chrome 很早就在实验性选项里内置了 Hardware Secure Decryption/Hardware Secure Decryption Experiment/Hardware Secure Decryption Fallback 三个选项,但是实测开启或关闭对 Widevine CDM 没什么影响。
三个选项:
Hardware Secure Decryption(Enable/Disable the use of hardware secure Content Decryption Module (CDM) for protected content playback.)
Hardware Secure Decryption Experiment(Enable/Disable the use of hardware secure Content Decryption Module (CDM) for experimental protected content playback.)
Hardware Secure Decryption Fallback(Allows automatically disabling hardware secure Content Decryption Module (CDM) after failures or crashes. Subsequent playback may use software secure CDMs. If this feature is disabled, the fallback will never happen and users could be stuck with playback failures.)
讨论提示:YouTube TV 和 YouTube 不同,YouTube TV 是观看美国电视直播的流媒体平台,更类似于 Netflix ,Disney+
#Decryption #CDM #Hardware #Secure #Widevine #Content #Module #YouTube #Chrome #secure
之前发过一帖进行讨论: https://www.v2ex.com/t/871652 ,@Satelli 回复说是 Widevine Content Decryption Module 的问题,前两天测试发现确实如此,在浏览器播放 YouTube TV 内容( DRM 内容)时,Widevine CDM 会占用非常多的 CPU 资源,总体占用在 i5-1135G7 上会直接到 100%,在 M1 MacBook Air 上会到 150%-180%,都非常恐怖。( Chrome 和 Edge 均测试)
有讨论这个问题是前几天在浏览 Chrome 107 支持 HEVC 硬解的文章时,看到了 Widevine CDM 将被弃用,Chrome 107 已经内置了一种新的 CDM ,目前讨论还很少,还不到新的 CDM 如何启用,对系统资源占用过多是否有改善。这对于浏览器网页观看 Netflix ,Disney+不知道有多大影响。
相关链接: https://www.xda-developers.com/google-is-deprecating-widevine-for-chromium/
另外 Windows 版的 Chrome 很早就在实验性选项里内置了 Hardware Secure Decryption/Hardware Secure Decryption Experiment/Hardware Secure Decryption Fallback 三个选项,但是实测开启或关闭对 Widevine CDM 没什么影响。
三个选项:
Hardware Secure Decryption(Enable/Disable the use of hardware secure Content Decryption Module (CDM) for protected content playback.)
Hardware Secure Decryption Experiment(Enable/Disable the use of hardware secure Content Decryption Module (CDM) for experimental protected content playback.)
Hardware Secure Decryption Fallback(Allows automatically disabling hardware secure Content Decryption Module (CDM) after failures or crashes. Subsequent playback may use software secure CDMs. If this feature is disabled, the fallback will never happen and users could be stuck with playback failures.)
讨论提示:YouTube TV 和 YouTube 不同,YouTube TV 是观看美国电视直播的流媒体平台,更类似于 Netflix ,Disney+
#Decryption #CDM #Hardware #Secure #Widevine #Content #Module #YouTube #Chrome #secure
go 新手,为啥这个导包会报错啊/(ㄒoㄒ)/~~
```
ubuntu@ubuntu:~$ go mod tidy
...
go: finding module for package github.com/hashicorp/hcl/json/parser
go: finding module for package github.com/hashicorp/hcl/hcl/printer
go: finding module for package github.com/hashicorp/hcl/hcl/ast
go: finding module for package github.com/hashicorp/hcl/hcl/parser
...
github.com/spf13/viper imports github.com/spf13/viper/internal/encoding/hcl imports github.com/hashicorp/hcl/hcl/printer: module github.com/hashicorp/hcl@latest found (v1.0.0), but does not contain package github.com/hashicorp/hcl/hcl/printer
...
```
```bash
ubuntu@ubuntu:~$ go env
GO111MODULE="on"
...
GOVERSION="go1.19.2"
```
最离谱的是 `root` 用户使用 `go mod tidy` 没问题,但两个用户 `GOPATH` 下导的 `hcl` 包一摸一样,搞不清白,求助 ┭┮﹏┭┮
#hcl #github #com #go #hashicorp #module #package #ubuntu #... #finding
```
ubuntu@ubuntu:~$ go mod tidy
...
go: finding module for package github.com/hashicorp/hcl/json/parser
go: finding module for package github.com/hashicorp/hcl/hcl/printer
go: finding module for package github.com/hashicorp/hcl/hcl/ast
go: finding module for package github.com/hashicorp/hcl/hcl/parser
...
github.com/spf13/viper imports github.com/spf13/viper/internal/encoding/hcl imports github.com/hashicorp/hcl/hcl/printer: module github.com/hashicorp/hcl@latest found (v1.0.0), but does not contain package github.com/hashicorp/hcl/hcl/printer
...
```
```bash
ubuntu@ubuntu:~$ go env
GO111MODULE="on"
...
GOVERSION="go1.19.2"
```
最离谱的是 `root` 用户使用 `go mod tidy` 没问题,但两个用户 `GOPATH` 下导的 `hcl` 包一摸一样,搞不清白,求助 ┭┮﹏┭┮
#hcl #github #com #go #hashicorp #module #package #ubuntu #... #finding
Angular SPA 分包加载后如果不同包没有同时更新,跳转路由经常会导致浏览器缓存的旧版本的包被加载,必须要手动刷新一下,怎么解决?
```
const routes: Routes = [
{
path: 'main',
loadChildren: () => import('./main/main.module').then(x => x.MainModule),
canActivate: [AuthGuard]
},
{path: 'sub', loadChildren: () => import('./sub/sub.module').then(x => x.SubModule)},
];
```
例如这样的 route ,从 `main/123` 用 `this.router.navigate` 跳转 `sub/456` 时,如果没有同时更新两个包的话浏览器总是会加载缓存的旧版本`SubModule`,必须要刷新。
#main #sub #path #loadChildren #import #module #SubModule #跳转 #const #routes
```
const routes: Routes = [
{
path: 'main',
loadChildren: () => import('./main/main.module').then(x => x.MainModule),
canActivate: [AuthGuard]
},
{path: 'sub', loadChildren: () => import('./sub/sub.module').then(x => x.SubModule)},
];
```
例如这样的 route ,从 `main/123` 用 `this.router.navigate` 跳转 `sub/456` 时,如果没有同时更新两个包的话浏览器总是会加载缓存的旧版本`SubModule`,必须要刷新。
#main #sub #path #loadChildren #import #module #SubModule #跳转 #const #routes
RF Modules for Smartphones
We all know that the experience of a smartphone depends on the SoC mobile platform it carries, which in turn consists of CPU, GPU, ISP, NPU, and Modem (baseband, also known as Baseband) and other units.
If you ask who is affecting the Internet speed, latency and stability of a smartphone when surfing the Internet? I believe that the answer of many friends is the baseband.
However, the baseband is not the only thing that affects the network performance. The radio frequency + antenna module is also the behind-the-scenes hero that allows the mobile phone to surf the Internet.
In theory, a complete RF module contains "RF + antenna", but for ease of understanding we split them into two parts. If you are interested in the antenna design of mobile phones, you can refer to "The baseband is not enough for 5G mobile phones! Antenna design also has to do surgery! "In this article, we will focus on the RF module in this article.
Let's start with Huawei mobile phones
Last year, Huawei launched a series of new 4G mobile phones, including Mate 40 4G, Mate X2 4G and nova 8i (equipped with Snapdragon 662), which are much cheaper than the starting price of the 5G version.
#mobile #baseband #phones #also #Internet #antenna #module #RF #4G #smartphone
We all know that the experience of a smartphone depends on the SoC mobile platform it carries, which in turn consists of CPU, GPU, ISP, NPU, and Modem (baseband, also known as Baseband) and other units.
If you ask who is affecting the Internet speed, latency and stability of a smartphone when surfing the Internet? I believe that the answer of many friends is the baseband.
However, the baseband is not the only thing that affects the network performance. The radio frequency + antenna module is also the behind-the-scenes hero that allows the mobile phone to surf the Internet.
In theory, a complete RF module contains "RF + antenna", but for ease of understanding we split them into two parts. If you are interested in the antenna design of mobile phones, you can refer to "The baseband is not enough for 5G mobile phones! Antenna design also has to do surgery! "In this article, we will focus on the RF module in this article.
Let's start with Huawei mobile phones
Last year, Huawei launched a series of new 4G mobile phones, including Mate 40 4G, Mate X2 4G and nova 8i (equipped with Snapdragon 662), which are much cheaper than the starting price of the 5G version.
#mobile #baseband #phones #also #Internet #antenna #module #RF #4G #smartphone
请教如何排查 nginx 未响应情况
**我是开发者,目前不知道往哪方面查,请广大 v 友提供思路**
## 问题与现状
不定期出现访问未响应情况,持续时间几分钟,期间 nginx 映射所有访问不了,并服务器也 ssh 不上,日志没出现 Too many open files 等任何报错
服务器:阿里 ecs.g7.large ,2 核 8G 内存
nginx 自己编译
``` bash
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/home/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-pcre --with-pcre-jit --with-debug
```
部署服务:很多静态文件,但不是 js 、css 这些
访问量:不太清楚怎么算
## 目前排查情况
1. 调整过 worker_connections 不起作用
2. 在未响应期间,看 cpu 指标,没有明显新增,看 tcp 连接数 ESTABLISHED 和 TIME_WAIT 也不多,因不太懂 tcp 这块,不知是不是这块问题
## nginx 核心配置 摘要
``` conf
#user nobody;
worker_processes 2;
worker_cpu_affinity auto;
pid logs/nginx.pid;
error_log /home/nginx/logs/error.log notice;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
accept_mutex on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
#access_log logs/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
keepalive_timeout 65;
send_timeout 30s;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
proxy_connect_timeout 5s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types text/css text/xml application/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6].";
include /home/nginx/conf/conf.d/*.conf;
}
```
#-- #http #nginx #module #gzip #timeout #worker #tcp #conf #log
**我是开发者,目前不知道往哪方面查,请广大 v 友提供思路**
## 问题与现状
不定期出现访问未响应情况,持续时间几分钟,期间 nginx 映射所有访问不了,并服务器也 ssh 不上,日志没出现 Too many open files 等任何报错
服务器:阿里 ecs.g7.large ,2 核 8G 内存
nginx 自己编译
``` bash
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/home/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-pcre --with-pcre-jit --with-debug
```
部署服务:很多静态文件,但不是 js 、css 这些
访问量:不太清楚怎么算
## 目前排查情况
1. 调整过 worker_connections 不起作用
2. 在未响应期间,看 cpu 指标,没有明显新增,看 tcp 连接数 ESTABLISHED 和 TIME_WAIT 也不多,因不太懂 tcp 这块,不知是不是这块问题
## nginx 核心配置 摘要
``` conf
#user nobody;
worker_processes 2;
worker_cpu_affinity auto;
pid logs/nginx.pid;
error_log /home/nginx/logs/error.log notice;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
accept_mutex on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
#access_log logs/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
keepalive_timeout 65;
send_timeout 30s;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
proxy_connect_timeout 5s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types text/css text/xml application/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6].";
include /home/nginx/conf/conf.d/*.conf;
}
```
#-- #http #nginx #module #gzip #timeout #worker #tcp #conf #log
[emerg] "stream" directive is not allowed 怎么解哈,已经安装了模块
安装的是 oneinstack,
在 nginx.conf 插入 stream 代码的时候报错,
显示的是`nginx: [emerg] "stream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:86`
```
stream {
map $ssl_preread_server_name $backend_name {
test.domain.net trojan;
test1.domain.net web;
test2.domain.net web;
}
upstream trojan {
server 127.0.0.1:50443;
}
upstream web {
server 127.0.0.1:445;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass $backend_name;
ssl_preread on;
}
}
```
网上普遍反应是没有安装模块,但似乎是装了的哈
```
nginx version: nginx/1.22.1
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1s --with-pcre=../pcre-8.45 --with-pcre-jit --with-ld-opt=-ljemalloc
```
感谢
#-- #module #http #nginx #stream #ssl #server #conf #preread #name
安装的是 oneinstack,
在 nginx.conf 插入 stream 代码的时候报错,
显示的是`nginx: [emerg] "stream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:86`
```
stream {
map $ssl_preread_server_name $backend_name {
test.domain.net trojan;
test1.domain.net web;
test2.domain.net web;
}
upstream trojan {
server 127.0.0.1:50443;
}
upstream web {
server 127.0.0.1:445;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass $backend_name;
ssl_preread on;
}
}
```
网上普遍反应是没有安装模块,但似乎是装了的哈
```
nginx version: nginx/1.22.1
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1s --with-pcre=../pcre-8.45 --with-pcre-jit --with-ld-opt=-ljemalloc
```
感谢
#-- #module #http #nginx #stream #ssl #server #conf #preread #name