@@ -10,6 +10,7 @@ import (
10
10
11
11
"github.com/jessevdk/go-flags"
12
12
"github.com/mcstatus-io/mcutil/v3"
13
+ "github.com/mcstatus-io/mcutil/v3/options"
13
14
)
14
15
15
16
var (
19
20
)
20
21
21
22
type Options struct {
22
- Type string `short:"t" long:"type" description:"The type of status to retrieve" default:"java"`
23
- Timeout uint `short:"T" long:"timeout" description:"The amount of seconds before the status retrieval times out" default:"5"`
23
+ Type string `short:"t" long:"type" description:"The type of status to retrieve" default:"java"`
24
+ Timeout uint `short:"T" long:"timeout" description:"The amount of seconds before the status retrieval times out" default:"5"`
25
+ DisableSRV bool `short:"S" long:"disable-srv" description:"Disables SRV lookup"`
24
26
}
25
27
26
28
func init () {
@@ -87,25 +89,40 @@ func main() {
87
89
switch opts .Type {
88
90
case "java" :
89
91
{
90
- result , err = mcutil .Status (ctx , host , port )
92
+ result , err = mcutil .Status (ctx , host , port , options.JavaStatus {
93
+ EnableSRV : ! opts .DisableSRV ,
94
+ Timeout : time .Duration (opts .Timeout ) * time .Second ,
95
+ ProtocolVersion : 47 ,
96
+ })
91
97
92
98
break
93
99
}
94
100
case "raw" :
95
101
{
96
- result , err = mcutil .StatusRaw (ctx , host , port )
102
+ result , err = mcutil .StatusRaw (ctx , host , port , options.JavaStatus {
103
+ EnableSRV : ! opts .DisableSRV ,
104
+ Timeout : time .Duration (opts .Timeout ) * time .Second ,
105
+ ProtocolVersion : 47 ,
106
+ })
97
107
98
108
break
99
109
}
100
110
case "legacy" :
101
111
{
102
- result , err = mcutil .StatusLegacy (ctx , host , port )
112
+ result , err = mcutil .StatusLegacy (ctx , host , port , options.JavaStatusLegacy {
113
+ EnableSRV : ! opts .DisableSRV ,
114
+ Timeout : time .Duration (opts .Timeout ) * time .Second ,
115
+ ProtocolVersion : 47 ,
116
+ })
103
117
104
118
break
105
119
}
106
120
case "bedrock" :
107
121
{
108
- result , err = mcutil .StatusBedrock (ctx , host , port )
122
+ result , err = mcutil .StatusBedrock (ctx , host , port , options.BedrockStatus {
123
+ EnableSRV : ! opts .DisableSRV ,
124
+ Timeout : time .Duration (opts .Timeout ) * time .Second ,
125
+ })
109
126
110
127
break
111
128
}
0 commit comments