-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
badjson: Add context marshaler/unmarshaler
- Loading branch information
1 parent
94f0582
commit 8452992
Showing
13 changed files
with
285 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package json | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/sagernet/sing/common/json/internal/contextjson" | ||
) | ||
|
||
var ( | ||
MarshalContext = json.MarshalContext | ||
UnmarshalContext = json.UnmarshalContext | ||
NewEncoderContext = json.NewEncoderContext | ||
NewDecoderContext = json.NewDecoderContext | ||
UnmarshalContextDisallowUnknownFields = json.UnmarshalContextDisallowUnknownFields | ||
) | ||
|
||
type ContextMarshaler interface { | ||
MarshalJSONContext(ctx context.Context) ([]byte, error) | ||
} | ||
|
||
type ContextUnmarshaler interface { | ||
UnmarshalJSONContext(ctx context.Context, content []byte) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package json | ||
|
||
import "context" | ||
|
||
type ContextMarshaler interface { | ||
MarshalJSONContext(ctx context.Context) ([]byte, error) | ||
} | ||
|
||
type ContextUnmarshaler interface { | ||
UnmarshalJSONContext(ctx context.Context, content []byte) error | ||
} |
Oops, something went wrong.