diff --git a/Docker-compose.yml b/Docker-compose.yml index 9a639bc..404b5bc 100644 --- a/Docker-compose.yml +++ b/Docker-compose.yml @@ -19,8 +19,9 @@ services: container_name: gmud build: . ports: + - "1234:1234" # fgtrace but doesnt work - "2222:2222" - - "8080:8080" + - "8081:8081" volumes: - .:/code command: "./app" diff --git a/README.md b/README.md index 5a2181a..7da19c5 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,11 @@ A mud in go ## Features +What's broken: +1. //TODO: SSH only takes one key and right now I'm getting errors accessing it +2. //TODO: gmud container cant connect to database + 1. This is NOT a problem when running ./app from localhost + ## Todo 1. Let user create a new character @@ -13,16 +18,16 @@ A mud in go 5. CharacterRoutes GetUser returns the wrong list of characters, doesn't do its query 6. Require unique names sql queries Character.Name 7. Make a map of public keys -8. AccountLogin function runs login page on the server +8. *AccountLogin function runs login page on the server* 9. Docker-compose broken, gmud connection refused to mysql/localhost:3306 - can access w/ sqlstudio fine 10. Alive reports false need to switch to reverse bool or dead 11. Level shouldnt be 0 -12. +12. ## Api Paths -http://127.0.0.1:8080/characters/9 {id} +http://127.0.0.1:8081/characters/9 {id} ``` go r.GET("/characters", GetCharacters) @@ -30,7 +35,7 @@ http://127.0.0.1:8080/characters/9 {id} r.POST("/characters", CreateCharacter) r.PUT("/characters/:id", UpdateCharacters) r.DELETE("/characters/:id", DeleteCharacter) - r.Run(":8080") + r.Run(":8081") ``` diff --git a/cmd/app/app b/cmd/app/app index bb85a9c..dcb60db 100755 Binary files a/cmd/app/app and b/cmd/app/app differ diff --git a/cmd/app/fgtrace.json b/cmd/app/fgtrace.json new file mode 100644 index 0000000..50b5f63 --- /dev/null +++ b/cmd/app/fgtrace.json @@ -0,0 +1,210 @@ +[{"name":"hz","ph":"M","ts":0,"args":{"hz":99}} +,{"name":"process_name","ph":"M","ts":0,"pid":1,"tid":1,"args":{"name":"G1"}} +,{"name":"running/runnable","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"main.main","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net/http.ListenAndServe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net/http.(*Server).ListenAndServe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.Listen","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*sysListener).listenTCP","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.internetSocket","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.favoriteAddrFamily","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.supportsIPv4map","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"sync.(*Once).Do","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"sync.(*Once).doSlow","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*ipStackCapabilities).probe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.Bind","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.bind","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.syscall","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.syscall","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"syscall.bind","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"syscall.Bind","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.(*ipStackCapabilities).probe","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"sync.(*Once).doSlow","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"sync.(*Once).Do","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.supportsIPv4map","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.favoriteAddrFamily","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.internetSocket","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.(*sysListener).listenTCP","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net.Listen","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net/http.(*Server).ListenAndServe","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"net/http.ListenAndServe","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"main.main","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"running/runnable","ph":"E","ts":11112.125,"pid":1,"tid":1} +,{"name":"chan receive","ph":"B","ts":11112.125,"pid":1,"tid":1} +,{"name":"main.main","ph":"B","ts":11112.125,"pid":1,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":6,"tid":1,"args":{"name":"G6 main.main"}} +,{"name":"IO wait","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.Connect","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.dbConnection","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).ExecContext","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).exec","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":11112.125,"pid":6,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":7,"tid":1,"args":{"name":"G7 main.main"}} +,{"name":"IO wait","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/charactersroutes.CharactersRoutes","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"github.com/gin-gonic/gin.(*Engine).Run","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net/http.ListenAndServe","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net/http.(*Server).ListenAndServe","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net/http.(*Server).Serve","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net.(*TCPListener).Accept","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net.(*TCPListener).accept","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"net.(*netFD).accept","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"internal/poll.(*FD).Accept","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":11112.125,"pid":7,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":20,"tid":1,"args":{"name":"G20 database/sql.OpenDB"}} +,{"name":"select","ph":"B","ts":11112.125,"pid":20,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"B","ts":11112.125,"pid":20,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":82,"tid":1,"args":{"name":"G82 github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher"}} +,{"name":"select","ph":"B","ts":11112.125,"pid":82,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"B","ts":11112.125,"pid":82,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":99,"tid":1,"args":{"name":"G99 os/signal.Notify.func1.1"}} +,{"name":"syscall","ph":"B","ts":11112.125,"pid":99,"tid":1} +,{"name":"os/signal.loop","ph":"B","ts":11112.125,"pid":99,"tid":1} +,{"name":"os/signal.signal_recv","ph":"B","ts":11112.125,"pid":99,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":35,"tid":1,"args":{"name":"G35 main.main"}} +,{"name":"select","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"net.Listen","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"net.(*Resolver).resolveAddrList","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"net.(*Resolver).internetAddrList","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr","ph":"B","ts":11112.125,"pid":35,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":36,"tid":1,"args":{"name":"G36 internal/singleflight.(*Group).DoChan"}} +,{"name":"select","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"internal/singleflight.(*Group).doCall","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr.func1","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"net.glob..func1","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"net.(*Resolver).lookupIP","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"net.cgoLookupIP","ph":"B","ts":11112.125,"pid":36,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":37,"tid":1,"args":{"name":"G37 net.cgoLookupIP"}} +,{"name":"syscall","ph":"B","ts":11112.125,"pid":37,"tid":1} +,{"name":"net.cgoIPLookup","ph":"B","ts":11112.125,"pid":37,"tid":1} +,{"name":"net.cgoLookupIPCNAME","ph":"B","ts":11112.125,"pid":37,"tid":1} +,{"name":"net.cgoLookupIPCNAME.func1","ph":"B","ts":11112.125,"pid":37,"tid":1} +,{"name":"net._C2func_getaddrinfo","ph":"B","ts":11112.125,"pid":37,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).exec","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).ExecContext","ph":"E","ts":20573.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).PingContext","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":20573.875,"pid":6,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*Resolver).internetAddrList","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*Resolver).resolveAddrList","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.Listen","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"select","ph":"E","ts":20573.875,"pid":35,"tid":1} +,{"name":"IO wait","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).Serve","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*TCPListener).Accept","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*TCPListener).accept","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"net.(*netFD).accept","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"internal/poll.(*FD).Accept","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":20573.875,"pid":35,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":8,"tid":1,"args":{"name":"G8 database/sql.OpenDB"}} +,{"name":"select","ph":"B","ts":20573.875,"pid":8,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"B","ts":20573.875,"pid":8,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":10,"tid":1,"args":{"name":"G10 github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher"}} +,{"name":"select","ph":"B","ts":20573.875,"pid":10,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"B","ts":20573.875,"pid":10,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"E","ts":20573.875,"pid":82,"tid":1} +,{"name":"select","ph":"E","ts":20573.875,"pid":82,"tid":1} +,{"name":"net.cgoLookupIP","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"net.(*Resolver).lookupIP","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"net.glob..func1","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr.func1","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"internal/singleflight.(*Group).doCall","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"select","ph":"E","ts":20573.875,"pid":36,"tid":1} +,{"name":"net._C2func_getaddrinfo","ph":"E","ts":20573.875,"pid":37,"tid":1} +,{"name":"net.cgoLookupIPCNAME.func1","ph":"E","ts":20573.875,"pid":37,"tid":1} +,{"name":"net.cgoLookupIPCNAME","ph":"E","ts":20573.875,"pid":37,"tid":1} +,{"name":"net.cgoIPLookup","ph":"E","ts":20573.875,"pid":37,"tid":1} +,{"name":"syscall","ph":"E","ts":20573.875,"pid":37,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"E","ts":20573.875,"pid":20,"tid":1} +,{"name":"select","ph":"E","ts":20573.875,"pid":20,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"E","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).handleAuthResult","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readAuthResult","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":40439.875,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"E","ts":51160.167,"pid":8,"tid":1} +,{"name":"select","ph":"E","ts":51160.167,"pid":8,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"E","ts":51160.167,"pid":10,"tid":1} +,{"name":"select","ph":"E","ts":51160.167,"pid":10,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"net.(*netFD).Read","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"net.(*conn).Read","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readAuthResult","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).handleAuthResult","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"database/sql.(*DB).PingContext","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.dbConnection","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.Connect","ph":"E","ts":51160.167,"pid":6,"tid":1} +,{"name":"IO wait","ph":"E","ts":51160.167,"pid":6,"tid":1} +, \ No newline at end of file diff --git a/cmd/app/main.go b/cmd/app/main.go index 69f331c..932cbcc 100755 --- a/cmd/app/main.go +++ b/cmd/app/main.go @@ -56,7 +56,7 @@ func main() { return func(s ssh.Session) { user, _, _, _, _ := ssh.ParseAuthorizedKey( []byte("ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMrr9hgSKnoddIDmzFyMnf5qb3QTsG40/9UyhexKiw6z mike@mikej.dev"), - ) // TODO: Replace with file + ) // TODO: Replace with file https://github.com/charmbracelet/wishlist/blob/main/server.go#L158 switch { case ssh.KeysEqual(s.PublicKey(), user): wish.Println(s, "%s\n Authorized", user) // TODO: Echo username, not ssh string @@ -148,17 +148,21 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Quit case "l", "ctrl+l": mn.AccountLogin() + case "n", "ctrl+n": + //mn.NewAccount() + return m, tea.Quit } } return m, nil } func (m model) View() string { - s := "Welcome to gmud!\n" + s := "Welcome to gmud!\n\n" s += "Your terminal is: %s\n" s += "Your window size is x: %d y: %d\n\n" s += "The date is " + m.time.Format(time.RFC1123) + "\n\n" s += "Press 'l' to login\n" + s += "Press 'n' to create a new account\n" s += "Press 'q' to quit\n" return fmt.Sprintf(s, m.term, m.width, m.height) } diff --git a/diag/v0.01.mmd b/diag/v0.01.mmd new file mode 100644 index 0000000..6bb5447 --- /dev/null +++ b/diag/v0.01.mmd @@ -0,0 +1,7 @@ +graph TD + A[Christmas] -->|Get money| B(Go shopping) + B --> C{Let me think} + C -->|One| D[Laptop] + C -->|Two| E[iPhone] + C -->|Three| F[fa:fa-car Car] + \ No newline at end of file diff --git a/extra/newaccount.go b/extra/newaccount.go new file mode 100644 index 0000000..9e36802 --- /dev/null +++ b/extra/newaccount.go @@ -0,0 +1,115 @@ + +package menus + +import ( + "fmt" + "os" + + tea "github.com/charmbracelet/bubbletea" + //"github.com/charmbracelet/wish" +) + +type model struct { + choices []string // items on the list + cursor int // item our cursor is pointing at + selected map[int]struct{} // whats selected +} + +func initialModel() model { + return model{ + choices: []string{"Login", "Create Account", "Test"}, + + // A map which indicates which choices are selected. We're using + // the map like a mathematical set. The keys refer to the indexes + // of the `choices` slice, above. + selected: make(map[int]struct{}), + } +} + +func (m model) Init() tea.Cmd { + // Just return `nil`, which means "no I/O right now, please." + return nil +} + +func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { + switch msg := msg.(type) { + + // Is it a key press? + case tea.KeyMsg: + + // Cool, what was the actual key pressed? + switch msg.String() { + + // These keys should exit the program. + case "ctrl+c", "q": + return m, tea.Quit + + // The "up" and "k" keys move the cursor up + case "up", "k": + if m.cursor > 0 { + m.cursor-- + } + + // The "down" and "j" keys move the cursor down + case "down", "j": + if m.cursor < len(m.choices)-1 { + m.cursor++ + } + + // The "enter" key and the spacebar (a literal space) toggle + // the selected state for the item that the cursor is pointing at. + case "enter", " ": + _, ok := m.selected[m.cursor] + if ok { + delete(m.selected, m.cursor) + } else { + m.selected[m.cursor] = struct{}{} + } + } + } + + // Return the updated model to the Bubble Tea runtime for processing. + // Note that we're not returning a command. + return m, nil +} + +func (m model) View() string { + // The header + s := "Login or create account?\n\n" + + // Iterate over our choices + for i, choice := range m.choices { + + // Is the cursor pointing at this choice? + cursor := " " // no cursor + if m.cursor == i { + cursor = ">" // cursor! + } + + // Is this choice selected? + checked := " " // not selected + if _, ok := m.selected[i]; ok { + checked = "x" // selected! + } + + // Render the row + s += fmt.Sprintf("%s [%s] %s\n", cursor, checked, choice) + } + + // The footer + s += "\nPress q to quit.\n" + + // Send the UI for rendering + return s +} + + + +func NewAccount() error { + p := tea.NewProgram(initialModel()) + if err := p.Start(); err != nil { + fmt.Printf("Alas, there's been an error: %v", err) + os.Exit(1) + } + return nil +}/* */ \ No newline at end of file diff --git a/fgtrace.json b/fgtrace.json new file mode 100644 index 0000000..8e6def8 --- /dev/null +++ b/fgtrace.json @@ -0,0 +1,184 @@ +[{"name":"hz","ph":"M","ts":0,"args":{"hz":99}} +,{"name":"process_name","ph":"M","ts":0,"pid":1,"tid":1,"args":{"name":"G1"}} +,{"name":"running/runnable","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"main.main","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net/http.ListenAndServe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net/http.(*Server).ListenAndServe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.Listen","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*sysListener).listenTCP","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.internetSocket","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.favoriteAddrFamily","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.supportsIPv4map","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"sync.(*Once).Do","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"sync.(*Once).doSlow","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.(*ipStackCapabilities).probe","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"net.sysSocket","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.CloseOnExec","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.fcntl","ph":"B","ts":0,"pid":1,"tid":1} +,{"name":"syscall.fcntl","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"syscall.CloseOnExec","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.sysSocket","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.(*ipStackCapabilities).probe","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"sync.(*Once).doSlow","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"sync.(*Once).Do","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.supportsIPv4map","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.favoriteAddrFamily","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.internetSocket","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.(*sysListener).listenTCP","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net.Listen","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net/http.(*Server).ListenAndServe","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"net/http.ListenAndServe","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"main.main","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"running/runnable","ph":"E","ts":10472.375,"pid":1,"tid":1} +,{"name":"chan receive","ph":"B","ts":10472.375,"pid":1,"tid":1} +,{"name":"main.main","ph":"B","ts":10472.375,"pid":1,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":21,"tid":1,"args":{"name":"G21 main.main"}} +,{"name":"IO wait","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.Connect","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.dbConnection","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).ExecContext","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).exec","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).execDC","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.withLock","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).execDC.func2","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"database/sql.ctxDriverExec","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).ExecContext","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).Exec","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).exec","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readResultSetHeaderPacket","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"net.(*conn).Read","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"net.(*netFD).Read","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":10472.375,"pid":21,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":5,"tid":1,"args":{"name":"G5 database/sql.OpenDB"}} +,{"name":"select","ph":"B","ts":10472.375,"pid":5,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"B","ts":10472.375,"pid":5,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":34,"tid":1,"args":{"name":"G34 os/signal.Notify.func1.1"}} +,{"name":"syscall","ph":"B","ts":10472.375,"pid":34,"tid":1} +,{"name":"os/signal.loop","ph":"B","ts":10472.375,"pid":34,"tid":1} +,{"name":"os/signal.signal_recv","ph":"B","ts":10472.375,"pid":34,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":35,"tid":1,"args":{"name":"G35 main.main"}} +,{"name":"select","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"net.Listen","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"net.(*Resolver).resolveAddrList","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"net.(*Resolver).internetAddrList","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr","ph":"B","ts":10472.375,"pid":35,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":53,"tid":1,"args":{"name":"G53 internal/singleflight.(*Group).DoChan"}} +,{"name":"select","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"internal/singleflight.(*Group).doCall","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr.func1","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"net.glob..func1","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"net.(*Resolver).lookupIP","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"net.cgoLookupIP","ph":"B","ts":10472.375,"pid":53,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":54,"tid":1,"args":{"name":"G54 net.cgoLookupIP"}} +,{"name":"syscall","ph":"B","ts":10472.375,"pid":54,"tid":1} +,{"name":"net.cgoIPLookup","ph":"B","ts":10472.375,"pid":54,"tid":1} +,{"name":"net.cgoLookupIPCNAME","ph":"B","ts":10472.375,"pid":54,"tid":1} +,{"name":"net.cgoLookupIPCNAME.func1","ph":"B","ts":10472.375,"pid":54,"tid":1} +,{"name":"net._C2func_getaddrinfo","ph":"B","ts":10472.375,"pid":54,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":83,"tid":1,"args":{"name":"G83 github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher"}} +,{"name":"select","ph":"B","ts":10472.375,"pid":83,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"B","ts":10472.375,"pid":83,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"net.(*netFD).Read","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"net.(*conn).Read","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readResultSetHeaderPacket","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).exec","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).Exec","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).ExecContext","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.ctxDriverExec","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).execDC.func2","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.withLock","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).execDC","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).exec","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).ExecContext","ph":"E","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).PingContext","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"net.(*conn).Read","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"net.(*netFD).Read","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":20270,"pid":21,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":84,"tid":1,"args":{"name":"G84 database/sql.OpenDB"}} +,{"name":"select","ph":"B","ts":20270,"pid":84,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"B","ts":20270,"pid":84,"tid":1} +,{"name":"process_name","ph":"M","ts":0,"pid":86,"tid":1,"args":{"name":"G86 github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher"}} +,{"name":"select","ph":"B","ts":20270,"pid":86,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"B","ts":20270,"pid":86,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"E","ts":20270,"pid":83,"tid":1} +,{"name":"select","ph":"E","ts":20270,"pid":83,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"E","ts":20270,"pid":5,"tid":1} +,{"name":"select","ph":"E","ts":20270,"pid":5,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*Resolver).internetAddrList","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*Resolver).resolveAddrList","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*ListenConfig).Listen","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.Listen","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"select","ph":"E","ts":30333.25,"pid":35,"tid":1} +,{"name":"IO wait","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"main.main.func3","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).ListenAndServe","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"github.com/gliderlabs/ssh.(*Server).Serve","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*TCPListener).Accept","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*TCPListener).accept","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.(*netFD).accept","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"internal/poll.(*FD).Accept","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"B","ts":30333.25,"pid":35,"tid":1} +,{"name":"net.cgoLookupIP","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"net.(*Resolver).lookupIP","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"net.glob..func1","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"net.(*Resolver).lookupIPAddr.func1","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"internal/singleflight.(*Group).doCall","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"select","ph":"E","ts":30333.25,"pid":53,"tid":1} +,{"name":"net._C2func_getaddrinfo","ph":"E","ts":30333.25,"pid":54,"tid":1} +,{"name":"net.cgoLookupIPCNAME.func1","ph":"E","ts":30333.25,"pid":54,"tid":1} +,{"name":"net.cgoLookupIPCNAME","ph":"E","ts":30333.25,"pid":54,"tid":1} +,{"name":"net.cgoIPLookup","ph":"E","ts":30333.25,"pid":54,"tid":1} +,{"name":"syscall","ph":"E","ts":30333.25,"pid":54,"tid":1} +,{"name":"database/sql.(*DB).connectionOpener","ph":"E","ts":30333.25,"pid":84,"tid":1} +,{"name":"select","ph":"E","ts":30333.25,"pid":84,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).startWatcher.func1","ph":"E","ts":30333.25,"pid":86,"tid":1} +,{"name":"select","ph":"E","ts":30333.25,"pid":86,"tid":1} +,{"name":"internal/poll.runtime_pollWait","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).wait","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"internal/poll.(*pollDesc).waitRead","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"internal/poll.(*FD).Read","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"net.(*netFD).Read","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"net.(*conn).Read","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).fill","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*buffer).readNext","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readPacket","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*mysqlConn).readHandshakePacket","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/go-sql-driver/mysql.(*connector).Connect","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).conn","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"database/sql.(*DB).PingContext","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.dbConnection","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"github.com/mikejk8s/gmud/pkg/mysql.Connect","ph":"E","ts":30333.25,"pid":21,"tid":1} +,{"name":"IO wait","ph":"E","ts":30333.25,"pid":21,"tid":1} +, \ No newline at end of file diff --git a/go.mod b/go.mod index fa6222b..dfca5da 100644 --- a/go.mod +++ b/go.mod @@ -5,23 +5,29 @@ go 1.19 require ( github.com/charmbracelet/bubbletea v0.20.0 github.com/charmbracelet/wish v0.5.0 + github.com/felixge/fgtrace v0.1.0 + github.com/gin-gonic/gin v1.8.1 github.com/gliderlabs/ssh v0.3.4 - github.com/mikejk8s/go-api-server v0.0.0-20220821050611-9c89f9adca28 + github.com/go-sql-driver/mysql v1.6.0 github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739 + go.opentelemetry.io/otel v1.9.0 + go.opentelemetry.io/otel/exporters/jaeger v1.9.0 + go.opentelemetry.io/otel/sdk v1.9.0 ) require ( + github.com/DataDog/gostackparse v0.5.0 // indirect github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect github.com/caarlos0/sshmarshal v0.1.0 // indirect github.com/charmbracelet/keygen v0.3.0 // indirect github.com/charmbracelet/lipgloss v0.4.0 // indirect github.com/containerd/console v1.0.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/gin-gonic/gin v1.8.1 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/validator/v10 v10.10.0 // indirect - github.com/go-sql-driver/mysql v1.6.0 // indirect github.com/goccy/go-json v0.9.7 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/leodido/go-urn v1.2.1 // indirect @@ -35,12 +41,14 @@ require ( github.com/muesli/reflow v0.3.0 // indirect github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/stretchr/testify v1.8.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect - golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect - golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect + go.opentelemetry.io/otel/trace v1.9.0 // indirect + golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect + golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect + golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/text v0.3.7 // indirect google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 8cd8b0b..7e6ed19 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +github.com/DataDog/gostackparse v0.5.0 h1:jb72P6GFHPHz2W0onsN51cS3FkaMDcjb0QzgxxA4gDk= +github.com/DataDog/gostackparse v0.5.0/go.mod h1:lTfqcJKqS9KnXQGnyQMCugq3u1FP6UZMfWR0aitKFMM= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/caarlos0/sshmarshal v0.1.0 h1:zTCZrDORFfWh526Tsb7vCm3+Yg/SfW/Ub8aQDeosk0I= @@ -16,12 +18,19 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/felixge/fgtrace v0.1.0 h1:cuMLI5NoBg/9IxIVmJzsxA3Aoz5eIKRca6WE1U2C1zc= +github.com/felixge/fgtrace v0.1.0/go.mod h1:VYPh/jE5zczuRiQge0AtcpNmcLhV/epE/wpfVYQALlU= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gliderlabs/ssh v0.3.4 h1:+AXBtim7MTKaLVPgvE+3mhewYRawNLTd+jEEz/wExZw= github.com/gliderlabs/ssh v0.3.4/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= @@ -35,8 +44,8 @@ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM= github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= @@ -59,8 +68,6 @@ github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mikejk8s/go-api-server v0.0.0-20220821050611-9c89f9adca28 h1:SJptlaXqryyyQ5kevGLT3RWBzsu3RBSFn+8GGN+taV8= -github.com/mikejk8s/go-api-server v0.0.0-20220821050611-9c89f9adca28/go.mod h1:CAG2Pa9qOhUYwTV7CLSZy3nCcF918Fu6q2ejw/pldsg= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= @@ -87,21 +94,33 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw= +go.opentelemetry.io/otel v1.9.0/go.mod h1:np4EoPGzoPs3O67xUVNoPPcmSvsfOxNlNA4F4AC+0Eo= +go.opentelemetry.io/otel/exporters/jaeger v1.9.0 h1:gAEgEVGDWwFjcis9jJTOJqZNxDzoZfR12WNIxr7g9Ww= +go.opentelemetry.io/otel/exporters/jaeger v1.9.0/go.mod h1:hquezOLVAybNW6vanIxkdLXTXvzlj2Vn3wevSP15RYs= +go.opentelemetry.io/otel/sdk v1.9.0 h1:LNXp1vrr83fNXTHgU8eO89mhzxb/bbWAsHG6fNf3qWo= +go.opentelemetry.io/otel/sdk v1.9.0/go.mod h1:AEZc8nt5bd2F7BC24J5R0mrjYnpEgYHyTcM/vrSple4= +go.opentelemetry.io/otel/trace v1.9.0 h1:oZaCNJUjWcg60VXWee8lJKlqhPbXAPB51URuR47pQYc= +go.opentelemetry.io/otel/trace v1.9.0/go.mod h1:2737Q0MuG8q1uILYm2YYVkAyLtOofiTNGg6VODnOiPo= +go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 h1:syTAU9FwmvzEoIYMqcPHOcVm4H3U5u90WsvuYgwpETU= -golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -110,17 +129,17 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210422114643-f5beecf764ed/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= @@ -133,5 +152,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/charactersroutes/charactersroutes.go b/pkg/charactersroutes/charactersroutes.go index a2561d5..80301ab 100644 --- a/pkg/charactersroutes/charactersroutes.go +++ b/pkg/charactersroutes/charactersroutes.go @@ -80,5 +80,5 @@ func CharactersRoutes() { r.POST("/characters", CreateCharacter) r.PUT("/characters/:id", UpdateCharacters) r.DELETE("/characters/:id", DeleteCharacter) - r.Run(":8080") + r.Run(":8081") } diff --git a/pkg/menus/accountmenu.go b/pkg/menus/accountmenu.go index ebc292d..e4f3430 100644 --- a/pkg/menus/accountmenu.go +++ b/pkg/menus/accountmenu.go @@ -117,4 +117,5 @@ func AccountLogin() error { os.Exit(1) } return nil -} \ No newline at end of file +} + diff --git a/pkg/mysql/charactersdb.go b/pkg/mysql/charactersdb.go index 9e8e0dd..cb4124c 100644 --- a/pkg/mysql/charactersdb.go +++ b/pkg/mysql/charactersdb.go @@ -8,6 +8,7 @@ import ( //cr "github.com/mikejk8s/gmud/pkg/charactersroutes" m "github.com/mikejk8s/gmud/pkg/models" + "github.com/felixge/fgtrace" ) // func GetCharacters(code string) []m.Character { @@ -33,6 +34,7 @@ func GetCharacter() []m.Character { return nil } +defer fgtrace.Config{Dst: fgtrace.File("charactersdb-fgtrace.json")}.Trace().Stop() defer db.Close() results, err := db.Query("SELECT * FROM characters") diff --git a/pkg/mysql/createdb.go b/pkg/mysql/createdb.go index 1c3522f..08e7062 100644 --- a/pkg/mysql/createdb.go +++ b/pkg/mysql/createdb.go @@ -13,6 +13,7 @@ import ( const ( username = "user" password = "password" + //hostname = "docker.for.mac.localhost:3306" hostname = "127.0.0.1:3306" dbname = "characters" ) @@ -69,7 +70,7 @@ func dbConnection() (*sql.DB, error) { func createCharacterTable(db *sql.DB) error { query := `CREATE TABLE IF NOT EXISTS characters ( id VARCHAR(15) UNIQUE NOT NULL PRIMARY KEY, - name VARCHAR(30) NOT NULL, + name VARCHAR(30) UNIQUE NOT NULL, class VARCHAR(15) NOT NULL, race VARCHAR(15) NOT NULL DEFAULT 'HUMAN', level INT(3) NOT NULL DEFAULT '1', diff --git a/pkg/tracing/jaeger.go b/pkg/tracing/jaeger.go new file mode 100644 index 0000000..7ac1497 --- /dev/null +++ b/pkg/tracing/jaeger.go @@ -0,0 +1,23 @@ +package tracing +import ( + "go.opentelemetry.io/otel/exporters/jaeger" + "go.opentelemetry.io/otel/sdk/resource" + sdktrace "go.opentelemetry.io/otel/sdk/trace" + semconv "go.opentelemetry.io/otel/semconv/v1.4.0" +) + +func JaegerTraceProvider()(*sdktrace.TracerProvider, error) { + exp, err: = jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint("http://localhost:14268/api/traces"))) + if err != nil { + return nil, err + } + tp: = sdktrace.NewTracerProvider( + sdktrace.WithBatcher(exp), + sdktrace.WithResource(resource.NewWithAttributes( + semconv.SchemaURL, + semconv.ServiceNameKey.String("gmud-service"), + semconv.DeploymentEnvironmentKey.String("production"), + )), + ) + return tp, nil +} \ No newline at end of file