add hostAndPort options
This commit is contained in:
@ -26,8 +26,8 @@ type SamOptions struct {
|
||||
|
||||
const handshakeReply string = "HELLO VERSION MIN=3.0 MAX=3.3\n"
|
||||
|
||||
func (s *SAMBridge) Start() {
|
||||
s.Options.Address = "127.0.0.1:7656"
|
||||
func (s *SAMBridge) Start(hostAndPort string) {
|
||||
s.Options.Address = hostAndPort
|
||||
err := s.dialSAMBridge()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
|
@ -30,10 +30,10 @@ type MasterSession struct {
|
||||
// i2cp and streaming options go here
|
||||
}
|
||||
|
||||
func NewMasterSession(destination string) (MasterSession, error) {
|
||||
func NewMasterSession(hostAndPort string, destination string) (MasterSession, error) {
|
||||
sb := new(sambridge.SAMBridge)
|
||||
sb.Options.Address = "127.0.0.1:7656"
|
||||
go sb.Start()
|
||||
sb.Options.Address = hostAndPort
|
||||
go sb.Start(hostAndPort)
|
||||
ms := MasterSession{Style: "MASTER"}
|
||||
ms.Ready = make(chan bool, 1)
|
||||
if destination == "" {
|
||||
@ -99,6 +99,5 @@ func (ms *MasterSession) newStreamHandler() {
|
||||
log.Printf("StreamReply err: %s", streamReply.Err.Error())
|
||||
} else {
|
||||
log.Printf("StreamReply success!")
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ var (
|
||||
errSubSessionFailed = errors.New("the subsession failed :(")
|
||||
)
|
||||
|
||||
func NewStreamConnect(ID string, destination string, fromPort string) (Subsession, error) {
|
||||
func NewStreamConnect(hostAndPort string, ID string, destination string, fromPort string) (Subsession, error) {
|
||||
sb := new(sambridge.SAMBridge)
|
||||
go sb.Start()
|
||||
go sb.Start(hostAndPort)
|
||||
ss := Subsession{
|
||||
Style: "STREAM",
|
||||
ID: ID,
|
||||
@ -38,9 +38,9 @@ func NewStreamConnect(ID string, destination string, fromPort string) (Subsessio
|
||||
return ss, err
|
||||
}
|
||||
|
||||
func NewStreamAccept(ID string) (Subsession, error) {
|
||||
func NewStreamAccept(hostAndPort string, ID string) (Subsession, error) {
|
||||
sb := new(sambridge.SAMBridge)
|
||||
go sb.Start()
|
||||
go sb.Start(hostAndPort)
|
||||
ss := Subsession{
|
||||
Style: "STREAM",
|
||||
ID: ID,
|
||||
|
Reference in New Issue
Block a user