Skip to content

Commit b3b458b

Browse files
committed
refactor: SimPort 定数を config パッケージから sslsim パッケージに移動
SimPort はアプリ設定ではなく SSL Simulation Protocol の仕様値のため、 意味的なオーナーシップが正しい sslsim パッケージに const Port = 10300 として定義し直した。 config.GetSimAddress() は sslsim.Port を参照するよう更新。
1 parent 303a5cb commit b3b458b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

internal/config/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"fmt"
66
"os"
77
"sync"
8+
9+
"github.com/RoboCup-SSL/ssl-vision-client/internal/sslsim"
810
)
911

1012
const ConfigFilePath = "config.json"
@@ -15,8 +17,6 @@ const (
1517
RefereeIP = "224.5.23.1"
1618
)
1719

18-
const SimPort = 10300
19-
2020
// Config アプリケーション設定
2121
type Config struct {
2222
VisionPort int `json:"visionPort"`
@@ -135,9 +135,9 @@ func (c *Config) GetPorts() (vision, tracked, referee int) {
135135
return c.VisionPort, c.TrackedPort, c.RefereePort
136136
}
137137

138-
// GetSimAddress シミュレータのアドレスを取得(ポートは固定 10300
138+
// GetSimAddress シミュレータのアドレスを取得(ポートは固定 sslsim.Port
139139
func (c *Config) GetSimAddress() string {
140140
c.mu.RLock()
141141
defer c.mu.RUnlock()
142-
return fmt.Sprintf("%s:%d", c.SimAddress, SimPort)
142+
return fmt.Sprintf("%s:%d", c.SimAddress, sslsim.Port)
143143
}

internal/sslsim/const.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package sslsim
2+
3+
// Port は SSL Simulation Protocol の規定ポート番号
4+
const Port = 10300

0 commit comments

Comments
 (0)