├── LICENSE ├── entrypoint.sh ├── Dockerfile └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BIN="/opt/snell-server/snell-server" 4 | CONF="/etc/snell-server.conf" 5 | 6 | run() { 7 | # 打印作者和版本信息 8 | echo -e "Snell-Server\n" 9 | echo -e "Image: https://hub.docker.com/r/funnyzak/snell-server" 10 | echo -e "GitHub: https://github.com/funnyzak/snell-server\n" 11 | 12 | echo -e "Starting snell-server ${VERSION}...\n" 13 | 14 | if [ ! -f ${CONF} ]; then 15 | PSK=${PSK:-$(tr -dc A-Za-z0-9 ${CONF} 29 | [snell-server] 30 | listen = 0.0.0.0:${PORT} 31 | psk = ${PSK} 32 | ipv6 = ${IPV6} 33 | EOF 34 | 35 | if [ -n "${EGRESS_INTERFACE}" ]; then 36 | echo "egress-interface = ${EGRESS_INTERFACE}" >> ${CONF} 37 | fi 38 | fi 39 | 40 | echo "Config:" 41 | cat ${CONF} 42 | echo "" 43 | 44 | ${BIN} -c ${CONF} 45 | } 46 | 47 | run 48 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM --platform=$BUILDPLATFORM alpine AS builder 2 | 3 | ARG VERSION=5.0.1 4 | ARG TARGETPLATFORM 5 | 6 | WORKDIR /opt/snell-server 7 | 8 | RUN apk add --no-cache wget unzip && \ 9 | case "${TARGETPLATFORM}" in \ 10 | "linux/amd64") ARCH="amd64" ;; \ 11 | "linux/arm64") ARCH="aarch64" ;; \ 12 | "linux/arm/v7") ARCH="armv7l" ;; \ 13 | "linux/386") ARCH="i386" ;; \ 14 | *) echo "unsupported platform: ${TARGETPLATFORM}"; exit 1 ;; \ 15 | esac && \ 16 | wget --no-check-certificate -O snell.zip "https://dl.nssurge.com/snell/snell-server-v${VERSION}-linux-${ARCH}.zip" && \ 17 | unzip snell.zip 18 | 19 | FROM debian:stable-slim 20 | 21 | ARG BUILD_DATE 22 | ARG VERSION=5.0.1 23 | ARG VCS_REF 24 | 25 | LABEL org.label-schema.name="snell-server" \ 26 | org.label-schema.description="snell server is a lean encrypted proxy protocol." \ 27 | org.label-schema.version="${VERSION}" \ 28 | org.label-schema.vcs-ref="${VCS_REF}" \ 29 | org.label-schema.build-date="${BUILD_DATE}" \ 30 | org.label-schema.vendor="Leon" \ 31 | org.label-schema.url="https://github.com/funnyzak/docker-release" 32 | 33 | WORKDIR /opt/snell-server 34 | 35 | COPY --from=builder /opt/snell-server/snell-server . 36 | COPY entrypoint.sh . 37 | 38 | RUN chmod +x snell-server entrypoint.sh 39 | 40 | ENV LANG=C.UTF-8 \ 41 | VERSION=${VERSION} \ 42 | TZ=Asia/Shanghai \ 43 | PORT=6180 \ 44 | IPV6=false \ 45 | PSK= \ 46 | EGRESS_INTERFACE= 47 | 48 | EXPOSE ${PORT}/tcp 49 | 50 | ENTRYPOINT ["/opt/snell-server/entrypoint.sh"] 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Snell Server 2 | 3 | [![Image Size](https://img.shields.io/docker/image-size/funnyzak/snell-server)](https://hub.docker.com/r/funnyzak/snell-server/) 4 | [![Docker Stars](https://img.shields.io/docker/stars/funnyzak/snell-server.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/snell-server/) 5 | [![Docker Pulls](https://img.shields.io/docker/pulls/funnyzak/snell-server.svg?style=flat-square)](https://hub.docker.com/r/funnyzak/snell-server/) 6 | [![Docker Tags](https://img.shields.io/docker/v/funnyzak/snell-server?sort=semver&style=flat-square)](https://hub.docker.com/r/funnyzak/snell-server/) 7 | 8 | Snell Server is a lean encrypted proxy protocol. It is designed to be simple, lightweight. 9 | 10 | This image is build from the latest source code of [Snell Server](https://kb.nssurge.com/surge-knowledge-base/zh/release-notes/snell). It supports `linux/amd64`, `linux/arm64`, `linux/arm/v7`, `linux/386` architecture. 11 | 12 | ## Docker Pull 13 | 14 | ```bash 15 | docker pull funnyzak/snell-server 16 | # GHCR 17 | docker pull ghcr.io/funnyzak/snell-server 18 | # Aliyun 19 | docker pull registry.cn-beijing.aliyuncs.com/funnyzak/snell-server 20 | ``` 21 | 22 | ## Deployment 23 | 24 | Your can run this image with the following command: 25 | 26 | ```bash 27 | docker run -d --name snell-server --restart always -p 12303:6180 -e PSK="5G0H4qdf32mEZx32t" funnyzak/snell-server 28 | 29 | # With more options 30 | docker run -d --name snell-server --restart always \ 31 | -e PSK="5G0H4qdf32mEZx32t" \ 32 | -e TZ="Asia/Shanghai" \ 33 | -e IPV6="false" \ 34 | -e PORT=6180 \ 35 | -e EGRESS_INTERFACE="eth0" \ 36 | -p 12303:6180 funnyzak/snell-server:latest 37 | 38 | # Echo config file 39 | docker exec -it snell-server cat /etc/snell-server.conf 40 | ``` 41 | 42 | ## Docker Compose 43 | 44 | ```yaml 45 | version: '3' 46 | services: 47 | snell: 48 | image: funnyzak/snell-server 49 | container_name: snell-server 50 | environment: 51 | PSK: 5G0H4qdf32mEZx32t 52 | TZ: Asia/Shanghai 53 | IPV6: false 54 | PORT: 6180 55 | EGRESS_INTERFACE: eth0 # Optional: specify network interface for outbound connections 56 | restart: always 57 | ports: 58 | - 12303:6180 59 | ``` 60 | 61 | 62 | ## Environment Variables 63 | 64 | | Variable | Default | Description | 65 | |----------|---------|-------------| 66 | | `PSK` | Auto-generated | Pre-shared key for authentication | 67 | | `PORT` | `6180` | Port number for the server to listen on | 68 | | `IPV6` | `false` | Enable IPv6 support | 69 | | `EGRESS_INTERFACE` | - | Network interface name for outbound connections (e.g., `eth0`, `wlan0`) | 70 | 71 | ## Surge Configuration 72 | 73 | ```ini 74 | [Proxy] 75 | Proxy = snell, 1.2.3.4, 6333, psk=RANDOM_KEY_HERE, version=4 76 | ``` 77 | 78 | ## Reference 79 | 80 | - [Snell Knowledge](https://kb.nssurge.com/surge-knowledge-base/zh/release-notes/snell) --------------------------------------------------------------------------------