Add NativeDialer method to mtglib.Network

This commit is contained in:
9seconds
2026-03-12 19:25:53 +01:00
parent 6493688282
commit 94e4179fb7
7 changed files with 19 additions and 17 deletions
+4 -3
View File
@@ -8,10 +8,11 @@ import (
"net/http"
"github.com/9seconds/mtg/v2/essentials"
"github.com/9seconds/mtg/v2/mtglib"
)
type multiNetwork struct {
networks []Network
networks []mtglib.Network
}
func (m multiNetwork) Dial(network, address string) (essentials.Conn, error) {
@@ -22,7 +23,7 @@ func (m multiNetwork) DialContext(ctx context.Context, network, address string)
networks := m.networks
if len(networks) > 1 {
networks = make([]Network, len(m.networks))
networks = make([]mtglib.Network, len(m.networks))
copy(networks, m.networks)
rand.Shuffle(len(m.networks), func(i, j int) {
@@ -59,7 +60,7 @@ func (m multiNetwork) MakeHTTPClient(
return m.networks[0].MakeHTTPClient(dialFunc)
}
func Join(networks ...Network) (Network, error) {
func Join(networks ...mtglib.Network) (mtglib.Network, error) {
if len(networks) == 0 {
return nil, errors.New("cannot join no networks")
}