Sweb
A small web http&https server for test and upload file. Also support webdav and socks5/http/https proxy . Just one file to serve. Use golang and AI auto program.
Install / Use
/learn @twhite-gh/SwebREADME
🌐 Simple Web File Server v0.0.5
A lightweight Web file server written in Go, supporting static file serving, file upload, file browsing, WebDAV protocol, HTTPS encrypted connection, SOCKS5 proxy, HTTP proxy, and HTTPS proxy services. Supports bilingual interface (Chinese/English), with automatic switching based on browser language or manual selection.
✨ Project Features
- 🚀 Zero-Configuration Startup - Ready to use out of the box, automatically creates the necessary directory structure.
- 🔒 Security First - Advanced features are disabled by default and must be explicitly enabled via command-line arguments.
- 🔐 Authentication Support - WebDAV, HTTP Proxy, HTTPS Proxy, and SOCKS5 Proxy support Basic authentication to protect service security.
- 📂 File Browsing - Dedicated file browsing page, supports drag-and-drop multiple file uploads and progress display.
- 🌐 WebDAV Support - Complete WebDAV protocol implementation, supporting remote file management and authentication.
- 🔐 HTTPS Encryption - Supports SSL/TLS encrypted connections, ensuring data transfer security.
- 🌐 Proxy Services - Supports SOCKS5, HTTP, and HTTPS proxies, protected by Basic authentication.
- 📱 Real-time Status - Dynamically displays feature status, supports hot updates.
- 🎨 Modern Interface - Responsive design, supports bilingual interface (Chinese/English).
- 🌍 Multilingual Support - Automatic switching based on browser language, supports manual language selection.
- ⚙️ Flexible Configuration - Supports HTTP service switch, allowing only HTTPS or proxy services to be enabled.
📋 Key Features
📁 Static File Serving
Automatically serves all files in the web directory, supporting various file types like HTML, CSS, JavaScript, images, etc.
📤 File Upload
- Supports drag-and-drop multiple file uploads to the Web interface.
- Displays real-time upload progress bar.
- Supports various file formats.
- Security consideration: Disabled by default, requires explicit enabling.
📂 File Browsing
- Dedicated file browsing page, displaying all files in the
webdirectory. - Supports file type icon recognition and online preview.
- Clicking a file directly downloads it; displays file size and modification time.
- Security consideration: Disabled by default, requires explicit enabling.
🌐 WebDAV Service
- Complete WebDAV protocol support (RFC 4918).
- Runs on an independent port: Default port is 8081, not shared with the HTTP service.
- Supports both read/write and read-only modes.
- Configurable mount directory and custom port.
- Supports Basic authentication protection (Default username/password:
webdav/webdav). - Compatible with various WebDAV clients, with special optimization for Windows client compatibility.
- Fixes for Windows WebDAV client authentication, supporting network drive mapping.
- Independent WebDAV information page, displaying service status and mounting instructions.
🔐 HTTPS Service
- Supports SSL/TLS encrypted connections.
- Automatically loads certificate files from the
certdirectory. - Provides both HTTP and HTTPS services simultaneously.
- Real-time display of certificate status.
🔧 Automatic Configuration
Automatically creates the necessary directory structure, making it usable without manual configuration.
🚀 Quick Start
Download and Installation
- Download the executable file suitable for your system from the [可疑链接已删除] page.
- Alternatively, compile from source:
git clone <repository-url> cd sweb # Use the build script to compile for all platforms # Windows build.bat # Linux/macOS make all # Or manually compile (including all source files) go build -o sweb.exe ./src/main.go ./src/upload.go ./src/files.go ./src/webdav.go ./src/server.go ./src/utils.go ./src/socks5.go ./src/proxy.go ./src/https_proxy.go
Basic Usage
# Start the basic file server
./sweb.exe
# Enable file upload feature
./sweb.exe -upload
# Enable file browsing feature
./sweb.exe -files
# Enable WebDAV service
./sweb.exe -webdav
# Enable WebDAV service and turn on authentication (default port 8081)
./sweb.exe -webdav -webdav-auth
# Enable WebDAV service and specify a custom port
./sweb.exe -webdav -webdav-port 8082
# Enable HTTPS service
./sweb.exe -https
# Enable SOCKS5 proxy service
./sweb.exe -socks5
# Enable HTTP proxy service
./sweb.exe -proxy
# Enable SOCKS5 proxy service and turn on authentication
./sweb.exe -socks5 -socks5-auth
# Enable HTTP proxy service and turn on authentication
./sweb.exe -proxy -proxy-auth
# Enable HTTPS proxy service
./sweb.exe -https-proxy
# Enable HTTPS proxy service and turn on authentication
./sweb.exe -https-proxy -https-proxy-auth
# Only enable HTTPS service (turn off HTTP)
./sweb.exe -http=false -https
# Enable all features
./sweb.exe -upload -files -webdav -webdav-auth -https -socks5 -proxy -proxy-auth -https-proxy -https-proxy-auth
# View Chinese help information (default)
./sweb.exe -help
# View English help information
./sweb.exe -help-lang en -help
# Specify port
./sweb.exe -port 9000
# View help
./sweb.exe -help
📖 Command Line Arguments
| Parameter | Shorthand | Description | Default Value |
| :--- | :--- | :--- | :--- |
| --enable-upload | -upload | Enable file upload feature | Disabled |
| --enable-files | -files | Enable file browsing feature | Disabled |
| --enable-webdav | -webdav | Enable WebDAV service | Disabled |
| --webdav-dir | | Root directory for WebDAV service | Current directory |
| --webdav-port | | WebDAV server port | 8081 |
| --webdav-readonly | | WebDAV service read-only mode | Read/Write mode |
| --webdav-auth | | Enable WebDAV authentication | Disabled |
| --webdav-username | | WebDAV authentication username | webdav |
| --webdav-password | | WebDAV authentication password | webdav |
| --enable-http | -http | Enable HTTP service | Enabled |
| --https | | Enable HTTPS service | Disabled |
| --enable-socks5 | -socks5 | Enable SOCKS5 proxy service | Disabled |
| --socks5-auth | | Enable SOCKS5 proxy authentication | Disabled |
| --socks5-username | | SOCKS5 proxy authentication username | socks5 |
| --socks5-password | | SOCKS5 proxy authentication password | socks5 |
| --enable-proxy | -proxy | Enable HTTP proxy service | Disabled |
| --proxy-auth | | Enable HTTP proxy authentication | Disabled |
| --proxy-username | | HTTP proxy authentication username | http |
| --proxy-password | | HTTP proxy authentication password | http |
| --enable-https-proxy | -https-proxy | Enable HTTPS proxy service | Disabled |
| --https-proxy-auth | | Enable HTTPS proxy authentication | Disabled |
| --https-proxy-username | | HTTPS proxy authentication username | https |
| --https-proxy-password | | HTTPS proxy authentication password | https |
| --port | -p | HTTP server port | 8080 |
| --https-port | | HTTPS server port | 8443 |
| --socks5-port | | SOCKS5 proxy port | 1080 |
| --proxy-port | | HTTP proxy port | 10808 |
| --https-proxy-port | | HTTPS proxy port | 10443 |
| --cert-dir | | SSL certificate directory | ./cert |
| --help-lang | | Help message language (zh/en) | zh |
| --help | -h | Display help information | |
📂 File Browsing Feature
Enabling File Browsing
# Enable file browsing feature
./sweb.exe -files
# Enable both file browsing and upload
./sweb.exe -files -upload
Feature Characteristics
- File List: Grid layout displaying all files, supports file type icons.
- File Information: Displays file size, modification time, and file type.
- Online Download: Clicking a file directly downloads it.
- Real-time Refresh: Supports manual refreshing of the file list.
🌐 WebDAV Usage Guide
Enabling WebDAV Service
# Basic enablement (default port 8081)
./sweb.exe -webdav
# Specify directory and port
./sweb.exe -webdav -webdav-dir /path/to/files -webdav-port 8082
# Read-only mode
./sweb.exe -webdav -webdav-readonly
# Enable authentication
./sweb.exe -webdav -webdav-auth
# Full configuration example
./sweb.exe -webdav -webdav-auth -webdav-port 8082 -webdav-dir ./data
Client Connection
Windows System
- Open File Explorer.
- Right-click "This PC" → "Map network drive".
- Enter the address:
http://localhost:8081/webdav(default port). - If authentication is enabled, enter username:
webdav, password:webdav.
macOS System
- Open Finder.
- Press
Cmd + Kor select "Go" → "Connect to Server". - Enter the address:
http://localhost:8081/webdav(default port). - If authentication is enabled, enter username:
webdav, password:webdav.
Linux System
# Install davfs2
sudo apt-get install davfs2
# Mount WebDAV (default port)
sudo mount -t davfs http://localhost:8081/webdav /mnt/webdav
# If authentication is enabled, you will be prompted for username and password
Mobile Devices
Use file management applications that support WebDAV:
- iOS: Documents by Readdle, FileBrowser
- Android: Solid Explorer, FX File Explorer
🔐 HTTPS Usage Guide
Enabling HTTPS Service
# Enable HTTPS service
./sweb.exe -https
# Specify certificate directory
./sweb.exe -https -cert-dir /path/to/certs
# Specify ports
./sweb.exe -https -http-port 8080 -https-port 8443
Certificate Configuration
- Create a
certfolder in the current directory. - Place SSL certificate files into the
certdirectory:server.crt- Certifi
Related Skills
openhue
349.0kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
349.0kElevenLabs text-to-speech with mac-style say UX.
weather
349.0kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.6kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
