Skip to content

yangziwen/zy-ftp

Repository files navigation

zy-ftp

Chinese Doc

Introduction

A netty based ftp server

Feature

  • Implements most frequently used ftp commands (see details)
  • Support configurations of user access priviledge and file transfer rate limit (see options)
  • Both active mode and passive mode are supported under cleartext transmission
  • Only passive mode is supported when transfer data over TLS
  • Only passive mode is supported when running inside a docker container

Usage

  • Running an embedded server
    1. Import the dependency
    <dependency>
        <groupId>io.github.yangziwen</groupId>
        <artifactId>zy-ftp</artifactId>
        <version>0.0.2</version>
    </dependency>
    1. Start the server
    FtpRunner runner = FtpRunner.builder()
        .localIp("127.0.0.1")
        .localPort(8121)
        .configFile(new File("conf/server.config"))
        .logFile(new File("log/zy-ftp.log"))
        .build();
    
    runner.run();
  • Running the JAR file standalone
    1. Build the JAR file :mvn package -Pstandalone or sh gradlew build
    2. Start the server:java -jar zy-ftp.jar -c ${config_file_path}
  • Running inside a docker container
    1. Build the docker image:mvn package dockerfile:build -Pstandalone or sh gradlew dockerBuild
    2. Start the container:
    docker run -d \
      -v ${your_config_file}:/zy-ftp/server.config \
      -v ${your_resource_folder}:/zy-ftp/res \
      -e LOCAL_PORT=8121 \
      -p 8121:8121 \
      -e PASSIVE_PORTS=40000-40060 \
      -p 40000-40060:40000-40060 \
      zy-ftp:0.0.2
    
  • See more options:java -jar zy-ftp.jar -h