version compat system start

This commit is contained in:
adman
2026-03-09 21:30:31 +01:00
parent 165075ea02
commit c516cc5283
8 changed files with 213 additions and 99 deletions
+14 -3
View File
@@ -7,13 +7,24 @@ import (
"github.com/admin-else/strom/proto_base"
)
// Connect connects to the given address note that it does not resolve the SRV records its just a raw net.Dial
// Connect connects to the given address note that it does not resolve the SRV records it's just a raw net.Dial
func Connect(addr string) (ret *proto.Conn, err error) {
ret = &proto.Conn{}
err = ret.SetVersion("1.21.8")
s, err := Status(addr)
if err != nil {
return
}
ret, err = ConnectVersionLess(addr)
if err != nil {
return
}
err = ret.SetProtocolVersion(s.Version.Protocol)
return
}
// ConnectVersionLess connects to the given address without setting the version you should set it
// when using this function.
func ConnectVersionLess(addr string) (ret *proto.Conn, err error) {
ret = &proto.Conn{}
ret.SetState(proto_base.Handshaking)
ret.SetCompressionThreshold(-1)
ret.Actor = proto_base.Client