fix: reject non tunnel request & reject duplicated port

This commit is contained in:
2025-04-08 23:14:42 +07:00
parent 5350bc13a9
commit 0117931817
6 changed files with 51 additions and 16 deletions

View File

@ -16,7 +16,7 @@ type Server struct {
}
func NewServer(config ssh.ServerConfig) *Server {
listener, err := net.Listen("tcp", ":2200")
listener, err := net.Listen("tcp", fmt.Sprintf(":%s", utils.Getenv("port")))
if err != nil {
log.Fatalf("failed to listen on port 2200: %v", err)
return nil
@ -45,7 +45,7 @@ func NewServer(config ssh.ServerConfig) *Server {
}
func (s *Server) Start() {
fmt.Println("SSH server is starting on port 2200...")
log.Println("SSH server is starting on port 2200...")
for {
conn, err := (*s.Conn).Accept()
if err != nil {