no-src / gofs

A cross-platform real-time file synchronization tool out of the box based on Golang
Apache License 2.0
460 stars 40 forks source link

80端口占用 #375

Closed molixiaoge closed 1 month ago

molixiaoge commented 1 month ago

gofs 设置tls=false,并且更改端口,还是提示80端口被占用

./gofs -source="rs://127.0.0.1:8105?mode=server&local_sync_disabled=true&path=./source&fs_server=https://127.0.0.1:50000" -dest=./dest -users="gofs|password|r" -tls=false 
[2024-08-06 19:38:31] [INFO] file server [:80] starting...
[2024-08-06 19:38:31] [WARN] file server is not a security connection, you need the https replaced maybe!
[2024-08-06 19:38:31] [ERROR] running the http server error. listen tcp :80: bind: permission denied
[2024-08-06 19:38:31] [ERROR] start the file server [:80] error. listen tcp :80: bind: permission denied
mstmdev commented 1 month ago

Use the server_addr flag to specify the running port, for example, -server_addr=:8080.

Refer to #368 .

molixiaoge commented 1 month ago

好的

molixiaoge commented 1 month ago

80端口改了,如何不使用证书开启server->client同步?

服务端启动命令 ./gofs -source="rs://0.0.0.0:8105?mode=server&local_sync_disabled=true&path=./source&fs_server={http://127.0.0.1:18080}" -server_addr=:18080 -dest=./dest -users="gofs|password|rw" -tls=false -token_secret=1122334455667788

客户端启动命令 ./gofs -source="rs://192.168.56.102:8105" -dest=./dest -users="gofs|password" -token_secret=1122334455667788 -sync_once -tls=false

客户端提示

[2024-08-07 13:11:47] [INFO] monitor is starting...
[2024-08-07 13:11:47] [ERROR] start to monitor failed. rpc error: code = Unauthenticated desc = transport: cannot send secure credentials on an insecure connection
[2024-08-07 13:11:47] [INFO] gofs exited

另外如果客户端使用 ./gofs -source="rs://192.168.56.102:8105" -dest=./dest -users="gofs|password" -token_secret=1122334455667788 -tls=false 去掉 -sync_once 选项,服务器添加删除文件操作,客户端都没有任何提示只有 [2024-08-07 13:11:47] [INFO] monitor is starting...

mstmdev commented 1 month ago

我测试了下,之前不支持在没有证书的情况下进行认证,我添加了个临时方案来实现这个功能,可以拉取main分支的最新代码进行尝试,但是这是相当不安全的行为,建议只用于临时测试使用,正常使用还是要配置证书。

未来考虑强制使用证书,会移除所有在无证书模式下工作的代码。

另外上面的服务端启动命令中参数fs_server={http://127.0.0.1:18080}中的{}是多余的,需要进行删除才能正常运行。

molixiaoge commented 1 month ago

编译了主干代码可以同步了,但是中文同步有问题,创建了中文文件,同步一直报错

图片


[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
[2024-08-07 19:30:02] [ERROR] receive monitor message error. rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8
mstmdev commented 1 month ago

你的操作系统的当前字符集是什么,不是UTF-8吗?

molixiaoge commented 1 month ago

服务器和客户端都是 en_US.UTF-8

图片

图片

mstmdev commented 1 month ago

image

应该是程序读取到了非utf8的文件路径,在通过protobuf进行传输的时候,会进行utf8格式校验,此时就会报错。

我复现了一下,如果我手动修改了编码进行创建文件,会复现这个bug。

你检查看看是否是xftp的编码设置原因,或者直接在服务器上进行文件创建试试。

molixiaoge commented 1 month ago

好的