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 1
1
time-acquisition-mode : system
2
2
network :
3
3
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 :
4
6
vision-address : 224.5.23.2:10006
5
7
tracker-address : 224.5.23.2:10010
6
8
skip-interfaces : []
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ type Game struct {
67
67
// Network holds configs for network communication
68
68
type Network struct {
69
69
PublishAddress string `yaml:"publish-address"`
70
+ PublishNif string `yaml:"publish-nif"`
70
71
VisionAddress string `yaml:"vision-address"`
71
72
TrackerAddress string `yaml:"tracker-address"`
72
73
SkipInterfaces []string `yaml:"skip-interfaces"`
@@ -167,6 +168,7 @@ func (c *Controller) WriteTo(fileName string) (err error) {
167
168
// DefaultControllerConfig creates a config with default values
168
169
func DefaultControllerConfig () (c Controller ) {
169
170
c .Network .PublishAddress = "224.5.23.1:10003"
171
+ c .Network .PublishNif = ""
170
172
c .Network .VisionAddress = "224.5.23.2:10006"
171
173
c .Network .TrackerAddress = "224.5.23.2:10010"
172
174
c .Network .SkipInterfaces = []string {}
Original file line number Diff line number Diff line change 1
1
time-acquisition-mode : system
2
2
network :
3
3
publish-address : 224.5.23.1:10003
4
+ publish-nif :
4
5
vision-address : 224.5.23.2:10006
5
6
tracker-address : 224.5.23.2:10010
6
7
skip-interfaces : []
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ func NewGameController(cfg config.Controller) (c *GameController) {
35
35
c .config = cfg
36
36
c .gcEngine = engine .NewEngine (cfg .Game , cfg .Engine )
37
37
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 )
39
39
c .apiServer = api .NewServer (c .gcEngine )
40
40
c .autoRefServer = rcon .NewAutoRefServer (cfg .Server .AutoRef .Address , c .gcEngine )
41
41
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
12
12
// Publisher can publish state and commands to the teams
13
13
type Publisher struct {
14
14
address string
15
+ nif string
15
16
conns []* net.UDPConn
16
17
}
17
18
18
19
// 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 ) {
20
21
p = new (Publisher )
21
22
p .address = address
23
+ p .nif = nif
22
24
p .conns = []* net.UDPConn {}
23
25
return
24
26
}
@@ -38,6 +40,9 @@ func (p *Publisher) connect() bool {
38
40
if ip .To4 () == nil {
39
41
continue
40
42
}
43
+ if p .nif != "" && ip .String () != p .nif {
44
+ continue
45
+ }
41
46
laddr := & net.UDPAddr {
42
47
IP : ip ,
43
48
}
You can’t perform that action at this time.
0 commit comments