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"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"os"
|
|
||||||
)
|
|
||||||
|
|
||||||
import (
|
|
||||||
"milter-experiment/logging"
|
"milter-experiment/logging"
|
||||||
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -43,7 +40,7 @@ func handleMtaConnection(clientConnection *bufio.ReadWriter) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logger = logging.NewLogger(os.Stdout, os.Stderr, logging.DEBUG)
|
logger = logging.NewLogger(os.Stdout, os.Stderr, logging.DEBUG)
|
||||||
err := runServer()
|
err := runServer("127.0.0.1:7777")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Could not run server: %s\n", err.Error())
|
logger.Errorf("Could not run server: %s\n", err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"net"
|
"net"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runServer() error {
|
func runServer(listenAddr string) error {
|
||||||
serverSocket, err := net.Listen("tcp", "127.0.0.1:7777")
|
serverSocket, err := net.Listen("tcp", listenAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
myError := fmt.Errorf("could not create listening socket: %s", err.Error())
|
myError := fmt.Errorf("could not create listening socket: %s", err.Error())
|
||||||
return myError
|
return myError
|
||||||
|
|
Loading…
Reference in New Issue