Allow setting listen address when calling runServer()
This commit is contained in:
parent
c748253803
commit
19e4cf14ae
7
main.go
7
main.go
|
@ -5,11 +5,8 @@ import (
|
|||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/hex"
|
||||
"os"
|
||||
)
|
||||
|
||||
import (
|
||||
"milter-experiment/logging"
|
||||
"os"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -43,7 +40,7 @@ func handleMtaConnection(clientConnection *bufio.ReadWriter) {
|
|||
|
||||
func main() {
|
||||
logger = logging.NewLogger(os.Stdout, os.Stderr, logging.DEBUG)
|
||||
err := runServer()
|
||||
err := runServer("127.0.0.1:7777")
|
||||
if err != nil {
|
||||
logger.Errorf("Could not run server: %s\n", err.Error())
|
||||
os.Exit(1)
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
"net"
|
||||
)
|
||||
|
||||
func runServer() error {
|
||||
serverSocket, err := net.Listen("tcp", "127.0.0.1:7777")
|
||||
func runServer(listenAddr string) error {
|
||||
serverSocket, err := net.Listen("tcp", listenAddr)
|
||||
if err != nil {
|
||||
myError := fmt.Errorf("could not create listening socket: %s", err.Error())
|
||||
return myError
|
||||
|
|
Loading…
Reference in New Issue