mirror of
https://github.com/shlldev/miniws.git
synced 2025-09-02 19:00:59 +02:00
refactor 2: put miniws code in isolated module in miniws/
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@
|
||||
!*.go
|
||||
!go.sum
|
||||
!go.mod
|
||||
!go.work
|
||||
|
||||
!README.md
|
||||
!LICENSE
|
||||
|
4
go.mod
4
go.mod
@@ -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
|
||||
|
12
main.go
12
main.go
@@ -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
8
miniws/consts.go
Normal 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
3
miniws/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module github.com/shlldev/miniws/miniws
|
||||
|
||||
go 1.22.2
|
0
miniws/go.sum
Normal file
0
miniws/go.sum
Normal file
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package miniws
|
||||
|
||||
import (
|
||||
"fmt"
|
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package miniws
|
||||
|
||||
import (
|
||||
"strconv"
|
@@ -1,4 +1,4 @@
|
||||
package main
|
||||
package miniws
|
||||
|
||||
import (
|
||||
"errors"
|
Reference in New Issue
Block a user