protobuf-ts-types
is a tool that automatically generates TypeScript types from Protobuf schemas without requiring any code generation or compilation steps. It leverages the Protobuf runtime library to infer types directly, offering a simpler and faster workflow for TypeScript developers working with Protobuf. This eliminates the need for separate code generation tools and keeps the TypeScript types synchronized with the Protobuf schemas, reducing potential errors. The project aims to improve developer experience and efficiency when using Protobuf in TypeScript projects.
This blog post details a method for blocking YouTube ads on Apple TV by intercepting and manipulating encrypted traffic using pfSense, a firewall and router platform. The author leverages pfSense's ability to decrypt TLS/SSL traffic, then uses a custom Python script to parse and filter Google's Protocol Buffer (protobuf) messages, removing the components associated with advertisements before re-encrypting and forwarding the modified traffic to the Apple TV. This approach eliminates ads without relying on DNS blocking or other methods that YouTube might easily circumvent. The post provides a detailed explanation of the setup process, including installing necessary packages, configuring pfSense, and implementing the Python script.
Hacker News commenters generally express skepticism about the effectiveness and practicality of the described method for blocking YouTube ads on Apple TV. Some doubt the claim that all YouTube ads are served via protobuf, suggesting the method is likely to break frequently. Others point out the resource intensiveness of decrypting and re-encrypting TLS traffic on less powerful hardware like the Apple TV. Several commenters propose alternative ad-blocking solutions like Pi-hole or NextDNS, arguing these are simpler and more robust. The privacy implications of MITMing TLS traffic are also raised. While some acknowledge the cleverness of the approach, the consensus leans towards it being more of a proof-of-concept than a practical, long-term solution.
Summary of Comments ( 13 )
https://news.ycombinator.com/item?id=43682547
Hacker News users generally expressed interest in the project, praising its approach to Protobuf type generation in TypeScript. Several commenters highlighted the advantages of avoiding code generation and runtime dependencies, contrasting it favorably with existing solutions like
protoc
andprotobufjs
. Some questioned the handling of specific Protobuf features likeoneof
andany
, and discussions arose around potential performance implications and the project's compatibility with existing JavaScript Protobuf libraries. The author actively engaged with commenters, clarifying design choices and addressing technical questions about the project's inner workings. Overall, the reception was positive, with many seeing the project as a promising alternative for TypeScript Protobuf integration.The Hacker News post titled "Show HN: Zero-codegen, no-compile TypeScript type inference from Protobufs" (https://news.ycombinator.com/item?id=43682547) sparked a discussion with several interesting comments.
Many commenters expressed appreciation for the project's approach of avoiding code generation, which simplifies workflows and reduces potential maintenance overhead. One commenter highlighted the elegance of using generics for this purpose, contrasting it with the often cumbersome code generation processes they've encountered.
Several users brought up comparisons to other Protobuf tooling within the TypeScript ecosystem.
ts-proto
was mentioned frequently, with some users highlighting perceived advantages and disadvantages of each project. The discussion touched upon performance characteristics, the level of type safety offered, and the developer experience in terms of setup and usage. One user specifically asked about the differences between the presented project andts-proto
regarding how they handle optional fields and oneofs, indicating a desire to understand the nuances of each approach.One commenter inquired about the handling of nested messages and the generation of appropriate TypeScript types, which led to a brief discussion about the library's capabilities in this area. Another user raised the important point of how
protobuf-ts-types
manages breaking changes introduced by modifications to the.proto
files, a crucial aspect for maintaining type safety in evolving projects.The topic of runtime type checking was also raised. While the project focuses on static type safety during development, one commenter questioned whether runtime validation against the inferred types is also performed, which could add an extra layer of robustness in production environments.
Overall, the comments section reflects a generally positive reception of the project, with users expressing interest in its unique approach and engaging in productive discussions comparing its features to existing solutions. The discussion also highlights key considerations for Protobuf tooling in TypeScript, including handling optional fields, oneofs, nested messages, breaking changes, and potential runtime type checking.