File tree Expand file tree Collapse file tree 5 files changed +12
-2
lines changed Expand file tree Collapse file tree 5 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 11time-acquisition-mode : system
22network :
33 publish-address : 224.5.23.1:10003
4+ # set a network IP to only publish to that network - else messages will be published to all network interfaces
5+ publish-nif :
46 vision-address : 224.5.23.2:10006
57 tracker-address : 224.5.23.2:10010
68 skip-interfaces : []
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ type Game struct {
6767// Network holds configs for network communication
6868type Network struct {
6969 PublishAddress string `yaml:"publish-address"`
70+ PublishNif string `yaml:"publish-nif"`
7071 VisionAddress string `yaml:"vision-address"`
7172 TrackerAddress string `yaml:"tracker-address"`
7273 SkipInterfaces []string `yaml:"skip-interfaces"`
@@ -167,6 +168,7 @@ func (c *Controller) WriteTo(fileName string) (err error) {
167168// DefaultControllerConfig creates a config with default values
168169func DefaultControllerConfig () (c Controller ) {
169170 c .Network .PublishAddress = "224.5.23.1:10003"
171+ c .Network .PublishNif = ""
170172 c .Network .VisionAddress = "224.5.23.2:10006"
171173 c .Network .TrackerAddress = "224.5.23.2:10010"
172174 c .Network .SkipInterfaces = []string {}
Original file line number Diff line number Diff line change 11time-acquisition-mode : system
22network :
33 publish-address : 224.5.23.1:10003
4+ publish-nif :
45 vision-address : 224.5.23.2:10006
56 tracker-address : 224.5.23.2:10010
67 skip-interfaces : []
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ func NewGameController(cfg config.Controller) (c *GameController) {
3535 c .config = cfg
3636 c .gcEngine = engine .NewEngine (cfg .Game , cfg .Engine )
3737 c .messageGenerator = publish .NewMessageGenerator ()
38- c .publisher = publish .NewPublisher (c .config .Network .PublishAddress )
38+ c .publisher = publish .NewPublisher (c .config .Network .PublishAddress , c . config . Network . PublishNif )
3939 c .apiServer = api .NewServer (c .gcEngine )
4040 c .autoRefServer = rcon .NewAutoRefServer (cfg .Server .AutoRef .Address , c .gcEngine )
4141 c .autoRefServerTls = rcon .NewAutoRefServer (cfg .Server .AutoRef .AddressTls , c .gcEngine )
Original file line number Diff line number Diff line change @@ -12,13 +12,15 @@ const maxDatagramSize = 8192
1212// Publisher can publish state and commands to the teams
1313type Publisher struct {
1414 address string
15+ nif string
1516 conns []* net.UDPConn
1617}
1718
1819// NewPublisher creates a new publisher that publishes referee messages via UDP to the teams
19- func NewPublisher (address string ) (p * Publisher ) {
20+ func NewPublisher (address , nif string ) (p * Publisher ) {
2021 p = new (Publisher )
2122 p .address = address
23+ p .nif = nif
2224 p .conns = []* net.UDPConn {}
2325 return
2426}
@@ -38,6 +40,9 @@ func (p *Publisher) connect() bool {
3840 if ip .To4 () == nil {
3941 continue
4042 }
43+ if p .nif != "" && ip .String () != p .nif {
44+ continue
45+ }
4146 laddr := & net.UDPAddr {
4247 IP : ip ,
4348 }
You can’t perform that action at this time.
0 commit comments