Files
honeydany/app/services/common.go
T

27 lines
539 B
Go

package services
import (
"net"
"time"
)
// LoggerFunc is a callback for emitting service records back to the app layer.
type LoggerFunc func(Record)
// Handler is a per-connection handler signature.
type Handler func(net.Conn)
// Now returns UTC time for records.
func Now() time.Time { return time.Now().UTC() }
// remote helpers (scoped to services package)
func remoteIP(addr string) string {
h, _, _ := net.SplitHostPort(addr)
return h
}
func remotePort(addr string) string {
_, p, _ := net.SplitHostPort(addr)
return p
}