Change network to accept DialFunc

This commit is contained in:
9seconds
2021-03-11 06:08:15 +03:00
parent 6b28488fbd
commit d6566e5dfb
18 changed files with 67 additions and 117 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ func (c *TypeBytes) UnmarshalText(data []byte) error {
return nil
}
func (c TypeBytes) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypeBytes) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
+1 -1
View File
@@ -29,7 +29,7 @@ func (c *TypeDuration) UnmarshalText(data []byte) error {
return nil
}
func (c TypeDuration) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypeDuration) MarshalText() ([]byte, error) {
return []byte(c.value.String()), nil
}
+1 -1
View File
@@ -24,7 +24,7 @@ func (c *TypeFloat) UnmarshalJSON(data []byte) error {
return nil
}
func (c *TypeFloat) MarshalText() ([]byte, error) { // nolint: unparam
func (c *TypeFloat) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
+3 -3
View File
@@ -32,7 +32,7 @@ func (c *TypeHostPort) UnmarshalText(data []byte) error {
return nil
}
func (c TypeHostPort) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypeHostPort) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
@@ -41,11 +41,11 @@ func (c TypeHostPort) String() string {
}
func (c TypeHostPort) HostValue(defaultValue net.IP) net.IP {
return c.host.Value(defaultValue)
return c.host.Value(defaultValue)
}
func (c TypeHostPort) PortValue(defaultValue uint) uint {
return c.port.Value(defaultValue)
return c.port.Value(defaultValue)
}
func (c TypeHostPort) Value(defaultHostValue net.IP, defaultPortValue uint) string {
+2 -2
View File
@@ -6,7 +6,7 @@ type TypeHTTPPath struct {
value string
}
func (c *TypeHTTPPath) UnmarshalText(data []byte) error { // nolint: unparam
func (c *TypeHTTPPath) UnmarshalText(data []byte) error {
if len(data) > 0 {
c.value = "/" + strings.Trim(string(data), "/")
}
@@ -14,7 +14,7 @@ func (c *TypeHTTPPath) UnmarshalText(data []byte) error { // nolint: unparam
return nil
}
func (c TypeHTTPPath) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypeHTTPPath) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
+1 -1
View File
@@ -24,7 +24,7 @@ func (c *TypeIP) UnmarshalText(data []byte) error {
return nil
}
func (c *TypeIP) MarshalText() ([]byte, error) { // nolint: unparam
func (c *TypeIP) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
+1 -1
View File
@@ -25,7 +25,7 @@ func (c *TypeMetricPrefix) UnmarshalText(data []byte) error {
return nil
}
func (c TypeMetricPrefix) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypeMetricPrefix) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}
+2 -2
View File
@@ -28,8 +28,8 @@ func (c *TypePort) UnmarshalJSON(data []byte) error {
return nil
}
func (c *TypePort) MarshalJSON() ([]byte, error) { // nolint: unparam
return []byte(c.String()), nil
func (c *TypePort) MarshalJSON() ([]byte, error) {
return []byte(c.String()), nil
}
func (c TypePort) String() string {
+1 -1
View File
@@ -26,7 +26,7 @@ func (c *TypePreferIP) UnmarshalText(data []byte) error {
return nil
}
func (c TypePreferIP) MarshalText() ([]byte, error) { // nolint: unparam
func (c TypePreferIP) MarshalText() ([]byte, error) {
return []byte(c.value), nil
}
+1 -1
View File
@@ -24,7 +24,7 @@ func (c *TypeURL) UnmarshalText(data []byte) error {
return nil
}
func (c *TypeURL) MarshalText() ([]byte, error) { // nolint: unparam
func (c *TypeURL) MarshalText() ([]byte, error) {
return []byte(c.String()), nil
}