Skip to content

Commit

Permalink
⚠️ change multicast ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamagoham authored and g3force committed Jul 16, 2024
1 parent 1275363 commit bd0471d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

require golang.org/x/net v0.23.0 // indirect
require (
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
Expand Down
11 changes: 9 additions & 2 deletions internal/app/publish/publisher.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package publish

import (
"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
"google.golang.org/protobuf/proto"
"log"
"net"

"github.com/RoboCup-SSL/ssl-game-controller/internal/app/state"
"golang.org/x/net/ipv4"
"google.golang.org/protobuf/proto"
)

const maxDatagramSize = 8192
Expand Down Expand Up @@ -51,6 +53,11 @@ func (p *Publisher) connect() bool {
log.Printf("Could not connect to '%v': %v", addr, err)
continue
}
conn2 := ipv4.NewPacketConn(conn)
err = conn2.SetMulticastTTL(32)
if err != nil {
log.Printf("Could not set TTL to 32: %v", err)
}

if err := conn.SetWriteBuffer(maxDatagramSize); err != nil {
log.Printf("Could not set write buffer to %v.", maxDatagramSize)
Expand Down

0 comments on commit bd0471d

Please sign in to comment.