nip/internal/agent/agent.go

22 lines
457 B
Go

package agent
import (
"git.lovezsh.com/lovezsh/nip/internal/forward"
"git.lovezsh.com/lovezsh/nip/internal/pkg/httptunnel"
)
type Agent struct {
httptunnel *httptunnel.Server
}
func New(addr string, token string, server string) *Agent {
forwarder := forward.New(server, token)
return &Agent{
httptunnel: httptunnel.New(addr, forwarder.Forward),
}
}
func (agent *Agent) ListenAndServe() (err error) {
return agent.httptunnel.ListenAndServe()
}