Code Monkey home page Code Monkey logo

gowebdav's Introduction

GoWebDAV

Share local files using WebDAV, lightweight and easy to use

English | 简体中文

Features

  • Implemented in Golang for high performance.

  • Finally compiled into a single binary file, no need for Apache or similar environments, with few dependencies.

  • Supports browser access.

  • Multiple WebDAV services can be enabled on the same port, each with different mount directories, usernames, and passwords.

  • Good Docker support.

Quick Start

Download the binary file from https://github.com/117503445/GoWebDAV/releases

Run

./gowebdav

GoWebDAV will automatically create sample files under the ./data path, with the following file structure

> tree ./data
./data
├── public-writable
│   └── 1.txt
├── public-readonly
│   └── 1.txt
└── private-writable
    └── 1.txt

Access http://localhost:80 in your browser to see the 3 different GoWebDAV services.

index

Among them, http://localhost:80/public-writable is the public-writable service, mapping to the local ./data/public-writable folder. It is unauthenticated and writable. You can view file contents in the browser and perform operations like upload and delete.

public-writable

http://localhost:80/public-readonly is the public-readonly service, mapping to the local ./data/public-readonly folder. It is unauthenticated and read-only. You can view file contents in the browser but cannot upload, delete, etc.

public-readonly

http://localhost:80/private-writable is the private-writable service, mapping to the local ./data/private-writable folder. It requires user authentication and is writable. After logging in with user1 and pass1, you can view file contents in the browser and perform operations like upload and delete.

private-writable

Besides using a browser, you can also access it using other WebDAV client tools.

You can configure the local path, user authentication, read-only status, and other properties of the WebDAV service by specifying the dav parameter. For details, see the Usage section.

Usage

./gowebdav --help # View help

./gowebdav --addr 127.0.0.1 # Listen on 127.0.0.1, default is 0.0.0.0
./gowebdav --port 8080 # Listen on port 8080, default is port 80

./gowebdav --dav "/dir1,/data/dir1,user1,pass1,true" # Configure folder path and properties

The dav parameter can specify the local path, user authentication, read-only status, and other properties of the WebDAV service.

Each local path can be configured for a WebDAV service, separated by semicolons. For example:

  • "/dir1,/data/dir1,user1,pass1,true;/dir2,/data/dir2,null,null,false" describes 2 services, mapping the folder /data/dir1 to the WebDAV service /dir1 and the folder /data/dir2 to the WebDAV service /dir2.

For each service, you need to separate 5 parameters with commas: service path, local path, username, password, read-only status. When both the username and password are null, no authentication is required. For example:

  • "/dir1,/data/dir1,user1,pass1,true" describes mapping /data/dir1 to the /dir1 service, where access requires the username and password user1 and pass1, respectively, and is read-only (prohibits upload, update, delete).
  • "/dir2,/data/dir2,null,null,false" describes mapping /data/dir2 to the /dir2 service, where no authentication is required and it is read-write.
  • "/dir3,/data/dir3,null,null,true" describes mapping /data/dir3 to the /dir3 service, where no authentication is required and it is read-only.

In particular, if there is only one service named /, you can access http://localhost:80 directly without specifying a service name. For example:

  • "/,/data/dir1,user1,pass1,true" describes mapping /data/dir1 to the / service, where access requires the username and password user1 and pass1, respectively, and is read-only.

When dav is not specified, the default dav parameter used by GoWebDAV is /public-writable,./data/public-writable,null,null,false;/public-readonly,./data/public-readonly,null,null,true;/private-writable,./data/private-writable,user1,pass1,false.

Docker

Prepare the local folder paths to be shared as /data/dir1 and /data/dir2.

docker run -it -d -v /data:/data -e dav="/dir1,/data/dir1,user1,pass1,true;/dir2,/data/dir2,null,null,false" -p 80:80 --restart=unless-stopped 117503445/go_webdav

Open http://localhost/dir1 and http://localhost/dir2 in your browser to access disk files in WebDAV format.

Pass the data parameter through the environment variable dav and specify the mapped port with -p 80:80.

Docker Compose

version: "3.8"
services:
  go_webdav:
    image: 117503445/go_webdav
    container_name: go_webdav
    restart: unless-stopped
    volumes:
      - /data:/data
    environment:
      - "dav=/dir1,/data/dir1,user1,pass1,true;/dir2,/data/dir2,null,null,false"
    ports:
      - "80:80" 

Security

GoWebDAV uses HTTP Basic Auth for authentication, with account passwords transmitted in plaintext, lacking security. If dealing with important files or passwords, be sure to use a layer of HTTPS with Nginx or Traefik proxy servers.

GoWebDAV currently does not have plans to directly support HTTPS, as I believe that tasks like domain names and certificate renewal should be handled at the higher-level proxy server.

Development

Refer to dev.md

Acknowledgements

https://github.com/dom111/webdav-js provides frontend support

gowebdav's People

Contributors

117503445 avatar dependabot[bot] avatar himanshupal avatar jipok avatar lk29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gowebdav's Issues

挂载webdav后,在客户端粘贴一个文件会消失

docker安装的go-webdav,配置已打开true
并用nginx代理转发端口到443,并套上https
安卓客户端NMM
挂载webdav,,查看
从本地复制一个文件
在挂载目录粘贴
会显示一个0KB文件
刷新一下,,文件就消失了.
挂载目录已权限777,,用户改为了nobody

手机浏览器访问问题

部署在debian12上,设置了登录验证可读写,手机浏览器访问登录能看到文件,但下载401,另外,建议优化一下h5页面

能否支持https

是否可以加入支持HTTPS
或者有支持HTTPS的配置文件示例

bug

如果配置里 目录配成/ 根目录的话,web端只能访问,不能点击进入子目录

另外web能否支持移动文件

可否用一个webdav服务,一个账户挂载多个硬盘?

用着很舒服的一个docker。x86 arm都可以用。
请教它可否用一个webdav服务,一个账户挂载多个硬盘? 应该怎么写docker命令?
现在使用一个账户对应一个硬盘,四个硬盘就得设置四个账户,在客户端挂载就得设置四次。

使用GoWebDAV的几个疑问

你好,高性能的gowebdav服务器我一直在寻找,很高兴能看到这种高性能服务器.
但是我有几个疑问:
第一:
如何使用raidrive或者windows自带的映射网络驱动器添加webdav映射.
我是用raidrive映射webdav时,提示我返回的是html页面,不是webdav地址.我只能通过浏览器访问. 不知道如何通过系统文件的方式访问.
第二:
我通过浏览器访问设置了密码的webdav服务, 提示看到了/dav1链接,点进去之后提示username wrong or password wrong
,但是也没有输入用户名和密码的地方. 我设置了用户名和密码为空后,到时能看到一闪而过的用户名和密码输入框.然后就显示出了文件.
第三:
如果我的密码中有特殊字符, 我们知道特殊字符做密码会更安全, 如果密码中本来就有逗号,分号, 这种复杂的密码,该如何添加?
再次感谢您贡献如此有前景的服务器,希望他越来越好.辛苦了

Config file

Hello!
Please add the ability to read settings from the config.ini/json/yaml file. For example:

host: 127.0.0.1
port: 82
path: D:\Test
auth:
  - user: user1
    pass: pass1
    rule: RWD
    sdir: .
  - user: user2
    pass: pass2
    rule: R
    sdir: /ADM

This will be convenient for a large number of WebDAV users!
Thanks!

go build main.go 过不了也

command-line-arguments

.\main.go:71:2: undefined: AppConfig
.\main.go:73:14: undefined: AppConfig
.\main.go:74:30: undefined: AppConfig

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.