no idea
This commit is contained in:
parent
fb77010302
commit
e480ec2db4
|
@ -1,6 +1,7 @@
|
|||
package cmd // code.bitsetter.de/fun/gosl/cmd
|
||||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
|
@ -13,14 +14,22 @@ import (
|
|||
var cmdServer = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Runs Gosl as a server",
|
||||
Long: "Runs Gosl as a server",
|
||||
Long: `Runs Gosl as a server
|
||||
|
||||
[TODO:]
|
||||
gosl.json for configuration (Port/Adress, Level)
|
||||
`,
|
||||
// Run:
|
||||
}
|
||||
|
||||
func handleConn(conn *net.TCPConn) {
|
||||
log.Println("Got a connection!")
|
||||
conn.Close()
|
||||
log.Println("Got a connection from: ", conn.RemoteAddr().String())
|
||||
|
||||
gobd := gob.NewDecoder(conn)
|
||||
var h data.Handshake
|
||||
gobd.Decode(&h)
|
||||
log.Println(h)
|
||||
conn.Close()
|
||||
}
|
||||
|
||||
func runServer(cmd *cobra.Command, args []string) {
|
||||
|
|
14
data/Network.go
Normal file
14
data/Network.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package data // code.bitsetter.de/fun/gosl/data
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type Handshake struct {
|
||||
Client int
|
||||
Name string
|
||||
}
|
||||
|
||||
func (h Handshake) String() string {
|
||||
return (h.Name + ": " + strconv.Itoa(h.Client))
|
||||
}
|
Loading…
Reference in New Issue
Block a user