mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:44:03 +03:00
Change network to accept DialFunc
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user