package main

import (
	"fmt"
	"log"
	"os"
)

func main() {
	if len(os.Args) < 2 {
		fmt.Println("start socks5 server error must provide listen port !")
		return
	}
	if len(os.Args) > 4 {
		fmt.Println("start socks5 server error !")
		return
	}
	username := ""
	password := ""
	if len(os.Args) == 4 {
		username = os.Args[2]
		password = os.Args[3]
	}

	port := os.Args[1]

	s, err := NewClassicServer(":"+port, "0.0.0.0", username, password, 0, 60)
	if err != nil {
		log.Println(err)
		return
	}
	// You can pass in custom Handler
	err = s.ListenAndServe(nil)
	if err != nil {
		log.Println(err)
		return
	}
}
