8 // BuilderConfig represents the builder container configuration
9 type BuilderConfig struct {
11 Port string `json:"port"`
12 SyncThingID string `json:"syncThingID"`
15 // NewBuilderConfig creates a new BuilderConfig instance
16 func NewBuilderConfig(stID string) (BuilderConfig, error) {
17 // Do we really need it ? may be not accessible from client side
18 ip, err := getLocalIP()
20 return BuilderConfig{}, err
24 IP: ip, // TODO currently not used
25 Port: "", // TODO currently not used
33 func getLocalIP() (string, error) {
34 addrs, err := net.InterfaceAddrs()
38 for _, address := range addrs {
39 // check the address type and if it is not a loopback the display it
40 if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
41 if ipnet.IP.To4() != nil {
42 return ipnet.IP.String(), nil
46 return "", errors.New("Cannot determined local IP")