2016-12-15 12:55:19 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
2016-12-21 18:10:14 -05:00
|
|
|
"strconv"
|
2016-12-15 12:55:19 -05:00
|
|
|
|
2016-12-21 18:10:14 -05:00
|
|
|
"github.com/majormjr/rcon"
|
2016-12-15 12:55:19 -05:00
|
|
|
)
|
|
|
|
|
2016-12-21 18:10:14 -05:00
|
|
|
func connectRC() error {
|
|
|
|
var err error
|
|
|
|
rconAddr := config.ServerIP + ":" + strconv.Itoa(config.FactorioRconPort)
|
|
|
|
FactorioServ.Rcon, err = rcon.Dial(rconAddr, config.FactorioRconPass)
|
2016-12-15 12:55:19 -05:00
|
|
|
if err != nil {
|
2016-12-21 18:10:14 -05:00
|
|
|
log.Printf("Cannot create rcon session: %s", err)
|
|
|
|
return err
|
2016-12-15 12:55:19 -05:00
|
|
|
}
|
2016-12-21 18:10:14 -05:00
|
|
|
log.Printf("rcon session established on %s", rconAddr)
|
2016-12-15 12:55:19 -05:00
|
|
|
|
2016-12-21 18:10:14 -05:00
|
|
|
return nil
|
2016-12-15 12:55:19 -05:00
|
|
|
}
|