Comments (16)
@imgk the issue is solved upstream by Caddy author Matt Holt by introducing a wait and retry mechanism. And he suggests using sync.Mutex
method for the lock file (quote "For in-process locking, definitely just use sync.Mutex."
)
could you take a look at it? thanks.
from caddy-trojan.
sudo journalctl -g 'empty|stale' -u caddy
from caddy-trojan.
Hi, caddy-trojan
uses the FileStorage
module to store data. So this might be an issue with caddy
not caddy-trojan
.
from caddy-trojan.
Hi,
caddy-trojan
uses theFileStorage
module to store data. So this might be an issue withcaddy
notcaddy-trojan
.
Thanks for your reply. Do you see these logs on your side if you are using caddy 2.6.4?
from caddy-trojan.
there is a file in /home/caddy/.local/share/caddy/trojan/xxxxxxxxxxx
, that is used to store up/down traffics, maybe related to that file?
from caddy-trojan.
looks like it is due to this commit : caddyserver/certmagic@79babff
from caddy-trojan.
looks like this kind of log can't be disabled because it does not have a logger
( namespace
field), thus not possible to exclude
temporary solution:
edit caddy.service, add one of
below options
[Service]
# newer systemd, e.g. on Archlinux
# ~ means discard, the following keyword is in extended regex (ERE) form
LogFilterPatterns=~FileStorage.*trojan
# older systemd, e.g. on debian 12
# this version of system does not have above option, we have to redirect logs to /dev/null
# WARNING: this will discard all logs except for caddy environ output
StandardError=null
why does it bother?
journalctl -g 'empty|stale' -u caddy | wc -l
:
32285
from caddy-trojan.
@imgk would you mind reading this comment? it basically says, .lock
should not be created empty.
when created , it stores timestamps info as json format.
caddyserver/certmagic#232 (comment)
from caddy-trojan.
i made a patch to disable traffic updating, thus disables creating lock files
do you think it is worthy making this as an option?
diff --git a/listener/listener.go b/listener/listener.go
index b8116c2..88efe02 100644
--- a/listener/listener.go
+++ b/listener/listener.go
@@ -192,11 +192,11 @@ func (l *Listener) loop() {
lg.Info(fmt.Sprintf("handle trojan net.Conn from %v", c.RemoteAddr()))
}
- nr, nw, err := l.Proxy.Handle(io.Reader(c), io.Writer(c))
+ _, _, err := l.Proxy.Handle(io.Reader(c), io.Writer(c))
if err != nil {
lg.Error(fmt.Sprintf("handle net.Conn error: %v", err))
}
- up.Consume(utils.ByteSliceToString(b[:trojan.HeaderLen]), nr, nw)
+ // up.Consume(utils.ByteSliceToString(b[:trojan.HeaderLen]), nr, nw)
}(conn, l.Logger, l.Upstream)
}
}
from caddy-trojan.
Hi, sorry for the late reply. If you want to stop storing traffic on disk, you can try to setup trojan like this.
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [":443"],
"listener_wrappers": [{
"wrapper": "trojan"
}],
"routes": [{
"handle": [{
"handler": "trojan",
"connect_method": true,
"websocket": true
},
{
"handler": "file_server",
"root": "/var/www/html"
}]
}]
}
}
},
"trojan": {
"upstream": {
"upstream": "memory"
},
"proxy": {
"proxy": "no_proxy"
},
"users": ["pass1234","word5678"]
},
"tls": {
"certificates": {
"automate": ["example.com"]
},
"automation": {
"policies": [{
"issuers": [{
"module": "acme",
"email": "[email protected]" //optional,recommended
},
{
"module": "zerossl",
"email": "[email protected]" //optional,recommended
}]
}]
}
}
}
}
from caddy-trojan.
thanks. that's basically replace caddy
with memory
?
from caddy-trojan.
Yes. When setting the value of upstream
to memory
, caddy-trojan wouldn't store traffic data to caddy FileStorage. Just store that data in computer memory.
from caddy-trojan.
will that store users
added via API in memory as well?
and even in memory, lock file is still generated on each connection?
from caddy-trojan.
would you mind to tell all the differences between caddy
and memory
from caddy-trojan.
caddy
: save to caddy
FileStorage
memory
: save to computer memory
from caddy-trojan.
thanks! i'll close now. it is caddy upstream issue (race condition).
from caddy-trojan.
Related Issues (20)
- 想了解一下这个插件的trojan是使用什么加密方式连接的 HOT 2
- connect_method 请教一下这个插件的用途 HOT 1
- 密码存放的位置 HOT 1
- 请问支持 trojan 的客户端模式吗 HOT 1
- 基于作者的项目,写了一个一键部署脚本 HOT 1
- 是否能考虑实现upstream参数 HOT 1
- GetUsers的API调用问题 HOT 1
- 能屏蔽**域名/ip 吗? HOT 4
- 想问下Traffic流量的统计单位是什么 HOT 1
- 与其他插件(klzgrad/forwardproxy)共存有问题 HOT 3
- 本插件使用当前Caddy master源码编译报错 HOT 3
- 打印了大量的log HOT 3
- Error when compiling caddy HOT 14
- 编译最新的caddy 2.7.0-beta.2.0(0e2c7e1)报错 HOT 1
- trojan与测试版caddy会出现panic HOT 5
- Caddy 版本依赖建议
- 一个有趣的现象
- 请教支援ipv6么?
- failed to build with 2cd4633 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from caddy-trojan.