refactor 2: put miniws code in isolated module in miniws/

This commit is contained in:
2025-08-03 15:39:42 +02:00
parent 18b1703485
commit b68bb68981
10 changed files with 25 additions and 15 deletions

1
.gitignore vendored
View File

@@ -7,6 +7,7 @@
!*.go
!go.sum
!go.mod
!go.work
!README.md
!LICENSE

4
go.mod
View File

@@ -1,5 +1,5 @@
module com.github/shlldev/miniws
module github.com/shlldev/miniws
go 1.22.2
go 1.24.5
require github.com/akamensky/argparse v1.4.0

6
go.work Normal file
View File

@@ -0,0 +1,6 @@
go 1.24.5
use (
.
./miniws
)

12
main.go
View File

@@ -5,17 +5,10 @@ import (
"os"
"github.com/akamensky/argparse"
)
const (
FILENAME_ACCESSLOG string = "access.log"
FILENAME_ERRORLOG string = "error.log"
FILENAME_IPFILTER string = "ipfilter.conf"
FILENAME_USERAGENTFILTER string = "useragentfilter.conf"
"github.com/shlldev/miniws/miniws"
)
func main() {
parser := argparse.NewParser("miniws", "")
port := parser.Int("p", "port", &argparse.Options{Default: 8040})
@@ -30,7 +23,6 @@ func main() {
return
}
webserver := NewWebServer(*port, *logFolder, *configFolder)
webserver := miniws.NewWebServer(*port, *logFolder, *configFolder)
webserver.Run()
}

8
miniws/consts.go Normal file
View File

@@ -0,0 +1,8 @@
package miniws
const (
FILENAME_ACCESSLOG string = "access.log"
FILENAME_ERRORLOG string = "error.log"
FILENAME_IPFILTER string = "ipfilter.conf"
FILENAME_USERAGENTFILTER string = "useragentfilter.conf"
)

3
miniws/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/shlldev/miniws/miniws
go 1.22.2

0
miniws/go.sum Normal file
View File

View File

@@ -1,4 +1,4 @@
package main
package miniws
import (
"fmt"

View File

@@ -1,4 +1,4 @@
package main
package miniws
import (
"strconv"

View File

@@ -1,4 +1,4 @@
package main
package miniws
import (
"errors"