Code refactoring for streams HandleFunc

This commit is contained in:
Alex X
2024-06-14 12:48:29 +03:00
parent 1ac9d54dab
commit ecfe802065
15 changed files with 53 additions and 93 deletions
+7 -2
View File
@@ -46,8 +46,13 @@ type Client struct {
recv int
}
func NewClient(id string) *Client {
return &Client{ID: id}
func Dial(source string) (*Client, error) {
id := strings.Replace(source[8:], "/", ":", 1)
client := &Client{ID: id}
if err := client.Dial(); err != nil {
return nil, err
}
return client, nil
}
func (c *Client) Dial() (err error) {