From 4523e4a9ba90c41c36b45627598b89e159c41d00 Mon Sep 17 00:00:00 2001 From: kenjitheman Date: Sat, 26 Aug 2023 20:35:25 +0300 Subject: [PATCH] refactor(project): reorganize project structure squash me baby --- README.md | 8 +++----- go.mod | 2 +- main.go => portscan.go | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) rename main.go => portscan.go (82%) diff --git a/README.md b/README.md index e09a53e..30601a6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

network scanner using golang

+

port scanner using golang

### @@ -11,9 +11,7 @@ ## project structure: ``` -├── go.mod -├── main.go -└── README.md + ``` ## installation @@ -21,7 +19,7 @@ - use go get: ``` -go get github.com/kenjitheman/ntwrkscan +go get github.com/nezutero/portscan ``` ## contributing diff --git a/go.mod b/go.mod index 10238c7..d2ec1f6 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module main.go +module github.com/nezutero/portscan go 1.20 diff --git a/main.go b/portscan.go similarity index 82% rename from main.go rename to portscan.go index 6f2c1a5..796e1cc 100644 --- a/main.go +++ b/portscan.go @@ -1,4 +1,4 @@ -package main +package portscan import ( "fmt" @@ -17,10 +17,7 @@ func scanPort(targetIP string, port int, timeout time.Duration) bool { return true } -func main() { - targetIP := "192.168.1.1" // your target IP - timeout := 2 * time.Second - +func StartPortScan(targetIP string, timeout time.Duration) { for port := 1; port <= 65535; port++ { if scanPort(targetIP, port, timeout) { fmt.Printf("[SUCCESS] port %d is open\n", port)