me when i dont use vcs properly

This commit is contained in:
adman
2025-12-30 14:15:43 +01:00
parent 0b493d43f3
commit 8400d8f5dc
15 changed files with 192 additions and 94 deletions
+4 -4
View File
@@ -4,7 +4,6 @@ import (
"log"
"net"
"github.com/admin-else/strom/event"
"github.com/admin-else/strom/proto"
"github.com/admin-else/strom/proto_base"
)
@@ -12,6 +11,7 @@ import (
func Servee(c net.Conn) (ret *proto.Conn) {
ret = &proto.Conn{}
ret.Version = "1.21.8"
ret.ProtocolVersion = 772
ret.State = proto_base.Handshaking
ret.CompressionThreshold = -1
ret.Actor = proto_base.Server
@@ -21,17 +21,17 @@ func Servee(c net.Conn) (ret *proto.Conn) {
return
}
func ServeClient(cNet net.Conn, factory func(c *proto.Conn) (h event.HandlerInst, err error)) (err error) {
func ServeClient(cNet net.Conn, factory func(c *proto.Conn) (h any, err error)) (err error) {
c := Servee(cNet)
h, err := factory(c)
if err != nil {
return
}
err = c.Start(h)
err = c.StartOne(h)
return
}
func StartServerWithFactory(listenAddr string, factory func(c *proto.Conn) (h event.HandlerInst, err error)) (err error) {
func StartServerWithFactory(listenAddr string, factory func(c *proto.Conn) (h any, err error)) (err error) {
l, err := net.Listen("tcp", listenAddr)
if err != nil {
return