All checks were successful
continuous-integration/drone/push Build is passing
Rename ServerOpts to Options and add an example Fix bug Fix bug Fix bug Reviewed-on: #142 Co-Authored-By: Lunny Xiao <xiaolunwen@gmail.com> Co-Committed-By: Lunny Xiao <xiaolunwen@gmail.com>
34 lines
485 B
Go
34 lines
485 B
Go
// +ignore
|
|
|
|
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"goftp.io/server/v2"
|
|
"goftp.io/server/v2/driver/file"
|
|
)
|
|
|
|
func main() {
|
|
driver, err := file.NewDriver("./")
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
s, err := server.NewServer(&server.Options{
|
|
Driver: driver,
|
|
Auth: &server.SimpleAuth{
|
|
Name: "admin",
|
|
Password: "admin",
|
|
},
|
|
Perm: server.NewSimplePerm("root", "root"),
|
|
})
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := s.ListenAndServe(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|