如何设置仅适用于我的局域网的golang服务器监听器

I am using iris platform to do programming in go language (I am very beginner). I want to make all my computers at home be available for accessing to go server which is one of the local machine as well. When I set the listener with my network IP (192.168.0.0) or with any specified IP (192.168.0.15) it gives me panic error back. Only available 0.0.0.0 or 127.0.0.1/localhost or 192.168.0.19 - that is same as localhost

import "net"

...

ln, err := net.Listen("tcp4", "192.168.12:9999")
    if err != nil{
        panic(err)
    }

    iris.Serve(ln)

...

The error is: panic: listen tcp4 192.168.0.12:9999: bind: The requested address is not valid in its context.

Thanks to all for help.

You should read up on how networking works but here are some points to get you started.

You listen on a port, not an IP address. So whatever machine you're using as your server, find your local IP address:

On Linux or Mac you can do it many ways:

ifconfig | grep netmask and get your local address eg. 192.168.x.xx

Then start up your server with your Go program and listen on a localhost port like 8080.

eg.

if err := http.ListenAndServe(":8080", nil); err != nil {
    //handle error
}

Then you can access the server with other machines in your house assuming they are on the same Wifi. Use a different computer and visit 192.168.x.xx:8080 from a browser.

To answer your question in your comments, outsiders cannot access your local server unless they have a connection to your Wifi.